Forum Replies Created
-
AuthorPosts
-
Long Nguyen
ModeratorHi there,
We haven't support to create new terms and content on the front end yet. Authors and custom fields like the user, so I recommend using the extension MB User Profile. It also helps users create/update users' information on the front end.
https://docs.metabox.io/extensions/mb-user-profile/Long Nguyen
ModeratorHi,
Please share the code that created the group, some screenshots of the console tab, and the list of plugins active (in Tools > Site Health > Info > Active Plugins). You can also deactivate all plugins except Meta Box, MB extensions and recheck the issue.
Long Nguyen
ModeratorHi Scott,
Please turn on the debug log and open the console tab of the browser to check if there is an error message. Also, please share some screenshots of this issue; it will help us to investigate the issue.
Long Nguyen
ModeratorHi,
You can use this code to print the label of the selected option.
$select = rwmb_meta( 'select_id' ); $select_settings = rwmb_get_field_settings( 'select_id' ); foreach ( $select_settings as $key => $value ) { if ( $key == 'options' ) { echo $value[$select]; } }Use this code to print out the array elements when getting the field settings.
echo "<pre>"; print_r( $select_settings ); echo "</pre>";Long Nguyen
ModeratorHi,
The code sample code is working well on my local site. Please ensure that the field ID is correct and the code is added to the post's template.
You can also share the code that creates the field image. I will take a closer look.
Long Nguyen
ModeratorHi,
Please use the helper function rwmb_get_field_settings() to get the field's settings: field’s name, field’s options (value, label) ...
And follow these guidelines to know how to add a comma for each item but the last one in the array
https://www.sitepoint.com/community/t/comma-after-each-item-in-array-except-last/18234
https://stackoverflow.com/questions/15692464/php-foreach-separating-each-loop-with-comma-except-the-last-element/15692487After working with PHP, you can use the proxy
mb.to apply the code in View.Long Nguyen
ModeratorHi,
Thanks for the idea. I will create a feature request to support CSS code for the field.
Long Nguyen
ModeratorHi David,
For a cloneable field or sub-field in a group, the value returns an array, so you have to use the loop to iterate over the array.
<p>Showing block single image:</p> {% set block_single_image = mb.mb_get_block_field( 'cloneableID_or_groupID' ) %} {% for item in block_single_image %} {{ item['sizes']['medium']['url'] }} {% endfor %}Use this code to print out the array structure:
<pre> {{ mb.print_r( block_single_image ) }} </pre>For more information, please follow the documentation
https://twig.symfony.com/doc/3.x/tags/for.html
https://docs.metabox.io/extensions/meta-box-group/#getting-sub-field-valueOctober 26, 2020 at 9:48 PM in reply to: ✅User to Post Relationship - Remove Metabox From User Profile #22583Long Nguyen
ModeratorHi,
By default, the meta box only shows for
fromobject. You can switch objectfromandtoto remove the meta box in the post and show in the user profile.MB_Relationships_API::register( [ 'id' => 'posts_to_users', 'from' => array( 'object_type' => 'user', ), 'to' => array( 'object_type' => 'post', 'post_type' => 'post', ), 'reciprocal' => true ] );Long Nguyen
ModeratorHi,
Point 1 always gets the data (field value) faster than point 2 for some reasons:
- Point 1:
- Get only one field value.
(Note that the call to the custom table will be cached, e.g. if you call the helper function several times for the same $post_id, it will only query once) -
Show the field value directly without using the loop.
-
Point 2:
- Get a group of field values.
- Need to use the loop to show sub-field value.
- Cannot query by sub-field value.
https://docs.metabox.io/extensions/mb-custom-table/#group-fields
Totally, it's up to your requirements.
October 26, 2020 at 10:12 AM in reply to: ✅User to Post Relationship - Remove Metabox From User Profile #22577Long Nguyen
ModeratorHi JC,
We can use the argument
'reciprocal' => trueto only show the relationship meta box when editing the post, only show for thefromargument.add_action( 'mb_relationships_init', function() { MB_Relationships_API::register( [ 'id' => 'posts_to_users', 'from' => array( 'object_type' => 'post', 'post_type' => 'post', ), 'to' => array( 'object_type' => 'user', ), 'reciprocal' => true ] ); } );https://docs.metabox.io/extensions/mb-relationships/#reciprocal-relationships
Long Nguyen
ModeratorHi Brian,
What are the dropdown field types that you are using? For the field
selectorselect_advanced, we can use the custom CSS code to span full-width select options./* select_advanced */ .rwmb-select_advanced-wrapper .rwmb-input > span.select2 { width: 100%; } /* select */ .rwmb-select-wrapper .rwmb-input > select { width: 100%; }Apply the CSS in the admin area with this plugin https://wordpress.org/plugins/admin-css-mu/.
Long Nguyen
ModeratorHi,
Thank you for your interest in this extension. We have a plan to support Comment Meta on the front end but with a lower priority. The new feature will come on the next time; please keep the extension up to date 🙂
October 24, 2020 at 1:42 PM in reply to: ✅What are the meta keys for the individual inputs in a cloneable field? #22567Long Nguyen
ModeratorHi,
With the extension Meta Box - Elementor Integrator, we can display the cloneable field when editing the post by Elementor (Pro).
The cloneable field saves the field ID as the meta key and value is a serialized string in the database so if you want to customize to show for each clone item, please create a shortcode and use the loop to browse each item.
Long Nguyen
ModeratorHi David,
There are two cases to create the
single_imagefield:- In the same block as you are doing, please use this code:
<p>Showing block single image:</p> {% set block_single_image = mb.mb_get_block_field( 'block_single_image' ) %} {{ block_single_image['sizes']['medium']['url'] }} <pre> {{ mb.print_r( block_single_image ) }} </pre>See more in the documentation https://docs.metabox.io/extensions/mb-blocks/#render_callback.
- The post meta, please use the code above:
<p>Showing post meta single image:</p> {% set post_meta_single_image = mb.rwmb_meta( 'post_meta_single_image', '', post_id ) %} {{ post_meta_single_image['sizes']['medium']['url'] }} <pre> {{ mb.print_r( post_meta_single_image ) }} </pre>See more in my screen record: https://share.getcloudapp.com/OAuJjLy7.
-
AuthorPosts