Forum Replies Created
-
AuthorPosts
-
May 25, 2022 at 8:45 AM in reply to: Category ARchive of wordpress doesn't Show the CPT of metabox #36170
Long Nguyen
ModeratorHi,
The taxonomy
categoryis assigned to post typepostby default, so if you assigncategoryto a CPT, there will be two CPTs connected to that taxonomy. And you will need to modify the query in the archive template to display two (or more) CPTs on the archive page. Just like$cpt_ab = new WP_Query( array( 'post_type' => array( 'cpt_a', 'cpt_b' ), 'posts_per_page' => -1 ) ); while ( $cpt_ab->have_posts() ) : $cpt_ab->the_post(); the_title(); endwhile; wp_reset_query();Read more on the documentation https://developer.wordpress.org/themes/basics/template-hierarchy/
https://developer.wordpress.org/reference/classes/wp_query/#post-type-parametersLong Nguyen
ModeratorHi John,
Custom fields created by Meta Box or ACF work similar, they are saved data to the database (default table wp_postmeta) with the field ID is the meta key and the field value is the meta value. Only the difference is the data type. So I think with some simple fields like text, textarea, wysiwyg, email ... they will work with the page builder like ACF.
If you want to move ACF to Meta Box, please follow this documentation https://docs.metabox.io/extensions/mb-acf-migration/
Long Nguyen
ModeratorHi,
The post type created by MB CPT is saved in the database as a post (post type
mb-post-type). So it is not possible to translate the post type label with Loco Translate if you create it by the builder.You can generate PHP code and add it to the file functions.php in the theme/child theme folder and follow this topic to know how to translate the CPT label.
https://wordpress.stackexchange.com/questions/367104/loco-translate-custom-post-and-custom-taxonomy-labels-not-translated-in-wp-admiAnd documentation https://docs.metabox.io/extensions/mb-custom-post-type/#getting-php-code
https://docs.metabox.io/extensions/meta-box-builder/#getting-php-codeLong Nguyen
ModeratorHi,
It is difficult to integrate Meta Box with Icon Pack like that. It will look like a
select_advancedfield with icons as options. You can try to create a new field type by following this documentation https://docs.metabox.io/creating-new-field-types/
Or create a service request here, I will inform the developer team to do custom development as an outsourcing service.
https://metabox.io/contact/Long Nguyen
ModeratorHi,
The conditional logic for tabs is not supported in the builder for now. You can use the custom code in the article to show/hide the tab. Something like
add_filter( 'rwmb_outside_conditions', function( $conditions ) { $conditions['.rwmb-tab-interest'] = array( 'hidden' => array( 'post_format', 'aside' ), ); return $conditions; } );Long Nguyen
ModeratorHi,
Can you please share the code that creates tabs, custom fields and the code that shows/hides the tab? I see it still works on my site.
May 23, 2022 at 9:19 PM in reply to: ✅How does MB Avatar Plugin enable the front end user to upload his avatar? #36152Long Nguyen
ModeratorHi Eddy,
Did you add this code to the file functions.php in the theme/child theme folder?
https://metabox.io/create-custom-avatar/#step-2-get-data-from-the-custom-avatar-field-to-set-as-profile-pictureThe solutions are a combination of some MB extensions and custom code to resolve a problem for the customer with a few clicks. So you can use MB extensions and follow the article above without using MB User Avatar to set the user avatar with a custom field and include it on the frontend shortcode, because the meta box in the solution MB User Avatar does not have the meta box ID.
Long Nguyen
ModeratorHi Cees,
Please refer to Keith's topic https://support.metabox.io/topic/fields-from-related-posts-do-not-show-in-view-of-custom-post-type/#post-36149
to use another query in your current query to get related posts.May 23, 2022 at 6:18 PM in reply to: Fields from related post(s) do not show in 'View' of Custom Post Type #36149Long Nguyen
ModeratorHi Keith,
It looks like the code relationship added from the Insert Field tab does not work with the custom query. You can create another query inside your current query, just like this
{% set args = { post_type: 'sponsor', posts_per_page: -1 } %} {% set posts = mb.get_posts( args ) %} <div> {% for post in posts %} <div> Sponsor: {{ post.post_title }} {% set args2 = { post_type: 'speaker', relationship: { id: 'sponsor-speaker', from: post.ID } } %} {% set posts2 = mb.get_posts( args2 ) %} {% for post2 in posts2 %} Related speaker: {{ post2.post_title }} <br> {% endfor %} </div> {% endfor %} </div>Refer to this documentation https://docs.metabox.io/extensions/mb-views/#custom-query
May 23, 2022 at 3:50 PM in reply to: ✅User Display Name instead of ID in MB Frontend Submission #36147Long Nguyen
ModeratorHi,
The field type
usersaved the user ID in the database, so it will display the user ID as the post title if you set the field ID topost_title(standard field of WP). You can use the functionwp_update_post()andget_userdata()to update the post title based on the user ID and hook the callback function to the actionrwmb_{$meta_box_id}_after_save_post. Refer to this topic
https://support.metabox.io/topic/append-a-related-posts-title-to-the-title-of-created-post/#post-33677And read more on the documentation https://docs.metabox.io/fields/user/#data
https://developer.wordpress.org/reference/functions/wp_update_post/
https://developer.wordpress.org/reference/functions/get_userdata/Long Nguyen
ModeratorHi,
You can try to create a staging site and disable all plugins except Meta Box, MB extensions, switch to the standard theme of WordPress and re-check this issue.
Let me know if the issue still happens.Long Nguyen
ModeratorHi,
You can try to create a staging site and disable all plugins except Meta Box, MB extensions, switch to the standard theme of WordPress and re-check this issue.
Let me know if the issue still happens.May 23, 2022 at 11:20 AM in reply to: ✅Allow users to create a new term on frontend submission #36139Long Nguyen
ModeratorHi,
Thank you for your feedback.
The new term is only created after publishing the post. So users have to select another taxonomy as the requirement of the field. I will inform the development team to support this case in future updates.
Long Nguyen
ModeratorHi,
You can try to use the property
countof the term object to show posts that are associated with the term.<div class="button">View: _COUNT SHOULD BE HERE SOMEHOW_ {{ collection.count }} models </div>Read more on the documentation https://developer.wordpress.org/reference/classes/wp_term/
Long Nguyen
ModeratorHi Warren,
Currently, there is no option to set relationships in bulk. You can create a custom query to get all posts, then add the relationship manually by using the code in that loop.
MB_Relationships_API::add( $from, $to, $id, $order_from = 1, $order_to = 1 );Read more on the documentation https://docs.metabox.io/extensions/mb-relationships/#add
https://developer.wordpress.org/reference/classes/wp_query/ -
AuthorPosts