Forum Replies Created
-
AuthorPosts
-
Long Nguyen
ModeratorHi Nick,
Please take a look at my screen record https://www.loom.com/share/38b868128794408cad69b6b69baee3f1.
I've created two post types Ingredient and Recipe then show the relationship meta box on the front end with Frontend Submission.
July 23, 2020 at 8:11 AM in reply to: ✅Add New Items to Taxonomy creates inconsistent results #20922Long Nguyen
ModeratorHi,
The code works as well on my local site, see this screen record https://www.loom.com/share/8d7532ebe7484c9a87a90291a9714960.
Could you please share all the code which creates fields? And open the Console tab of the browser to check if there are any error messages.
July 23, 2020 at 8:00 AM in reply to: ✅Select Tags and add a new tag with MB Frontend Submission #20921Long Nguyen
ModeratorHi Sinusite,
Please add the setting
'add_new' => trueto the field settings to create a new term when submitting the post. It looks like this https://share.getcloudapp.com/yAuYdB07.Long Nguyen
ModeratorRelate to this topic https://support.metabox.io/topic/custom-field-that-works-with-mb_relationships-api/
so I mark this topic as Resolved.Long Nguyen
ModeratorHi Brandon,
The field
taxonomyget the taxonomy by the functionget_termsof WordPress. Since version 5.2, Meta Box uses Ajax to increase the performance for the fieldselect_advancedbut too many terms might slow down the field query.You can try to limit the number of terms display to improve the loading time, please follow this documentation https://docs.metabox.io/fields/taxonomy/#limit-the-number-of-terms-for-pagination.
Long Nguyen
ModeratorHi Dave and Nick,
The relationship extension only supports to select posts related, impossible to add new post with this box.
July 22, 2020 at 9:50 AM in reply to: ✅Connecting Related Custom Post Types With Frontend Form #20893Long Nguyen
ModeratorHi Tobias,
Each relationship meta box has an ID:
{$relationship_id}_relationships_fromand{$relationship_id}_relationships_to. You can include these IDs in the form shortcode to show it on the front end.Long Nguyen
ModeratorHi Anson,
The function
get_the_posts_pagination()retrieves a paginated navigation to next/previous set of posts in the main query. In this case, the navigation shows all posts of the category. If you want to show the navigation for posts which have the specific metacountryisocode, you have to query to get posts byWP_Querythen show the pagination with the custom query via PHP code.For more information, please follow these documentations.
https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters
https://codex.wordpress.org/Pagination
https://developer.wordpress.org/reference/functions/get_the_posts_pagination/Long Nguyen
ModeratorHi,
Thank you for pointing this out, I'm going to check it and let you know later.
Long Nguyen
ModeratorHi,
Please share full code that you queries to show posts and pagination. I will take a closer look and give a quick response.
Long Nguyen
ModeratorHi,
You can enqueue the select2 library then apply the function
select2()to the selector with some Javascript code.function enqueue_select2_jquery() { wp_register_style( 'select2css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.css', false, '1.0', 'all' ); wp_register_script( 'select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.js', array( 'jquery' ), '1.0', true ); wp_enqueue_style( 'select2css' ); wp_enqueue_script( 'select2' ); } add_action( 'admin_enqueue_scripts', 'enqueue_select2_jquery' ); add_action( 'admin_footer', function() { ?> <script type="text/javascript"> jQuery(document).ready(function($) { $('#field_id').select2(); }); </script> <?php } );Follow this topic for more information https://stackoverflow.com/questions/48879027/how-to-add-select2-js-in-wordpress-admin-side-theme-options.
And please notice, the plugin Meta Box also enqueues the library select2 when display some fields
select(multiple => true),select_advanced... so be careful when loading another select2 Javascript file might happen a conflict.Long Nguyen
ModeratorHi,
The code above works as well with the custom field which is saved in the custom table. See my screen record https://www.loom.com/share/0f554824d7304f6a9735c8cc26629014.
Long Nguyen
ModeratorHi Nick,
I think you need three relationships:
- Activity to Contact
- Activity to Company
- Company to ContactSo when you edit a post type, you can choose 2 other post types as the relation.
Long Nguyen
ModeratorHi,
Could you please take some screenshots in the field group builder? The field
textis a basic field and it's available in my testing site, see the screen record.Long Nguyen
ModeratorHi Anson,
You should check the meta value of a post inside the loop because the archive page is a list of posts. The right code would be
{% for post in query.posts %} {% if(post.countryisocode == 'vn') %} {{ post.title }} {% endif %} {% endfor %} -
AuthorPosts