Forum Replies Created
-
AuthorPosts
-
Long Nguyen
ModeratorHi Will,
The shortcode has its own attribute to design the button, please read more on the documentation https://docs.metabox.io/extensions/mb-favorite-posts/#shortcodes
Long Nguyen
ModeratorHi Ole,
It works correctly on my demo site, here is the screenshot in the builder https://imgur.com/6bDowIu
Long Nguyen
ModeratorHi,
No, the admin column is registered even whether the field has value or not. You can remove the admin column for a field if the user logged in has a specific role as I mentioned above.
Long Nguyen
ModeratorHi,
It looks like GenerateBlocks is not fully compatible with Meta Box and pro extensions like MB Group to display subfield value. You can try to contact their support to ask for help with this case.
Or create a shortcode to display subfield value and add the shortcode to GenerateBlocks. Refer to this documentation https://docs.metabox.io/extensions/meta-box-group/#outputting-group-with-page-builders
Long Nguyen
ModeratorHi Ole,
You can use the operator "not equal to"
!=and assign the field ID to an empty value like this'visible' => [ 'field_id', '!=', '' ],that means "not empty".
Long Nguyen
ModeratorHi,
Running an anonymous function in an array is deprecated from PHP 7.2 and removed from PHP 8.0. Please use a declare function like the code you are doing.
September 7, 2022 at 10:15 PM in reply to: ℹ️Post title field dynamic tags list out duplicate custom fields #38211Long Nguyen
ModeratorHi,
Thanks for your feedback.
I've escalated this issue to the development team to fix it in the next update.
Long Nguyen
ModeratorHi Ole,
The map field does not support setting only zoom value as default, you have to add all address fields as the default value (lat, lng, zoom).
-6.233406,-35.049906,15Please read more on the documentation https://docs.metabox.io/fields/osm/#settings
Long Nguyen
ModeratorHi,
Can you please share the callback function that you use to display the list of posts?
Long Nguyen
ModeratorHi,
Yes, you should create a custom block to display the list of posts with more parameters. The block Query Loop of WordPress only supports adding some simple settings (post type, featured image, color ...)
Long Nguyen
ModeratorHi,
Thanks for reaching out.
The cloneable is a standard feature of Meta Box, it is applied to all field types. Please read more on the documentation https://docs.metabox.io/cloning-fields/
In your case, I think you can use a cloneable group with subfields to create sections for the CPT. But please notice that Meta Box helps you to create the custom fields and add values for the CPT in the backend and output the field values in the frontend with the raw data. If you want to display them in a pretty layout, you need to create your own custom code (HTML, CSS). Or using a page builder plugin that is compatible with Meta Box, such as Elementor, Beaver, Oxygen.
https://docs.metabox.io/extensions/meta-box-group/Long Nguyen
ModeratorHi,
You can hide an admin column for a user role/ID when registering the custom fields with code. For example:
function your_prefix_function_name( $meta_boxes ) { $admin_columns = true; global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); if( $user_role != 'administrator' ) $admin_columns = false; $meta_boxes[] = [ 'title' => __( 'My Custom Fields', 'your-text-domain' ), 'id' => 'my-custom-fields', 'fields' => [ [ 'name' => __( 'Text', 'your-text-domain' ), 'id' => 'text_9wwu55lol0q12', 'type' => 'text', 'admin_columns' => $admin_columns ], ], ]; return $meta_boxes; }This code will remove the admin columns of the text field if the logged in user is not an administrator.
Long Nguyen
ModeratorHi,
Please follow the sample code in the documentation to know how to set a taxonomy field value.
https://docs.metabox.io/functions/rwmb-set-meta/add_action( 'init', function() { rwmb_set_meta( 123, 'related_prod', 456 ); }, 99 );where
123is the post ID
456is the term ID
and check the correct field IDrelated_prod(with prefix).Long Nguyen
ModeratorHi Fergal,
In the callback function (or template), you can use the passing variable
$post_idto get the field value of the current post. Then use the field value in the query args, for example:function my_hero_callback( $attributes, $is_preview = false, $post_id = null ) { $field_value = rwmb_meta( 'field_id', '', $post_id ); $args = array( 'meta_key' => 'field_id', 'meta_value' => $field_value ); $query = new WP_Query( $args ); }Read more on the documentation https://docs.metabox.io/extensions/mb-blocks/#render_callback
https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parametersLong Nguyen
ModeratorHi,
The field image upload or image select does not support a feature fallback image like that. On the frontend, you can use the HTML code to display a default image if the image URL is broken. Refer to this topic https://stackoverflow.com/questions/980855/inputting-a-default-image-in-case-the-src-attribute-of-an-html-img-is-not-vali
-
AuthorPosts