Forum Replies Created
-
AuthorPosts
-
October 2, 2022 at 10:52 AM in reply to: ✅Custom Text Field with Shortcode not showing up correctly on frontend #38508
Long Nguyen
ModeratorHi,
You can use the WordPress function
do_shortcode()to render the shortcode on the frontend.<?php $value = rwmb_meta( 'size_guide' ) ?> <p><?php echo do_shortcode( $value ); ?></p>Read more on the documentation https://developer.wordpress.org/reference/functions/do_shortcode/
October 1, 2022 at 10:38 PM in reply to: ✅"Cannot use empty array elements in arrays" after adding code from Generator #38501Long Nguyen
ModeratorHi,
You are correct. I've also escalated this issue to the development team to fix it in future updates.
Long Nguyen
ModeratorHi,
Please remove the double curly brackets if you assign a value to a variable. It is used to print out the value.
{% set args = my_post_id %}and the shortcode should be
[mbv id="your-view-id" my_post_id="123"]You can follow the documentation to know how to use Twig https://twig.symfony.com/doc/3.x/templates.html
September 30, 2022 at 10:22 PM in reply to: ✅Please provide example for custom sanitization of nested subgroup fields #38494Long Nguyen
ModeratorHi,
If the field
sub_text1is a cloneable field, so the value is an array of values. You can sanitize a specific element of the array via the key. For example$sub_group = isset( $value['sub_group'] ) ? $value['sub_group'] : []; $sub_text1 = $sub_group['sub_text1']; if( !empty( $sub_text1 ) && is_array( $sub_text1 ) ){ $value['sub_group']['sub_text1'][0] = wp_kses_post( $sub_text1[0] ); }or this code if you want to sanitize all elements in the array
if( !empty( $sub_text1 ) && is_array( $sub_text1 ) ) { foreach ($sub_text1 as $key => $text_value) { $value['sub_group']['sub_text1'][$key] = wp_kses_post( $text_value ); } }Long Nguyen
ModeratorHi,
It is a must when saving the
<p>tag to the database, or other tags like<br>or newline character\nto know where to break the line.
If you want to move all HTML tags when saving value to the database, you can create your own sanitization for the field. Please read more on the documentation https://docs.metabox.io/sanitization/Long Nguyen
ModeratorHi,
I think it's not really hard to do. Here is an example
{% set args = { post_type: "listing", posts_per_page: 7} %} {% set posts = mb.get_posts( args ) %} {% for post in posts %} {{ post.title }} {% set term_list = mb.get_the_terms( post.ID, 'category' ) %} {% for term in term_list %} <div class="term-item {{ term.slug }}"> {{ term.name }} </div> {% endfor %} {% endfor %}Long Nguyen
ModeratorHi Kyle,
I see the Taxonomies option is not selected, screenshot https://monosnap.com/file/X64RTl7Gr3cLB9HNzziZ6D9d2UMGa0
Can you please recheck this?
September 30, 2022 at 8:23 AM in reply to: Fatal error: Memory size after Meta Box AIO is installed #38486Long Nguyen
ModeratorHi,
You are correct, the error occurs when your server runs out of memory to complete the task. If you've increased the memory limit by adding code to the file wp-config.php but it does not work, please try to contact your hosting support to ask for help with this case.
Long Nguyen
ModeratorHi,
It's the feature of Yoast SEO so I recommend contacting Yoast support to ask for further assistance. For the post, this extension supports count words as well.
September 29, 2022 at 4:53 PM in reply to: Fatal error: Memory size after Meta Box AIO is installed #38478Long Nguyen
ModeratorHi Mathew,
Can you please share full error log to let me know what happens on your site?
Long Nguyen
ModeratorHi Kirb,
You are using the WP function
get_posts()which means it will return posts only. If you want to get terms by post ID, please use the functionget_the_terms()
https://developer.wordpress.org/reference/functions/get_the_terms/Or if you want to create a term query to display terms only, please use the WP function
get_terms()
https://developer.wordpress.org/reference/functions/get_terms/September 29, 2022 at 4:30 PM in reply to: ✅How to display attachments of CPT in Admin Edit Screen #38476Long Nguyen
ModeratorHi,
Thanks for your additional information.
If you attach a media file to a post on the Media page > column Uploaded To, that means the post is set to the parent post of the media file (find in the column post_parent, table wp_posts)
This is not a post meta so it is not possible to create a custom field to assign those values to the field and display images when editing the post. You need to create a field like
image_advancedand select images manually.Long Nguyen
ModeratorHi Kirb,
You can refer to this topic to know how to query posts by multiple taxonomies https://support.metabox.io/topic/querying-terms-from-multiple-taxonomies/#post-36948
The post tag (default of WordPress) is also a taxonomy with the slug
post_tag, you can add this to the argument.September 29, 2022 at 9:28 AM in reply to: Minor Bug - Before after Text not loading in Groups #38471Long Nguyen
ModeratorHi Rick,
The field settings
before,afterjust help you to output the custom HTML to explain more details of the field on the backend (field appearance) when adding the field value. They are not saved data to the database so will not display on the skin, just field value.
Read more on the documentation https://docs.metabox.io/field-settings/Long Nguyen
ModeratorHi Kyle,
I cannot access the frontend dashboard or admin area to check if the new taxonomy is assigned to the post. Can you please share some screenshots (or a screen record) of the issue? And the code that creates the custom fields, taxonomy on your site?
After submitting the form, you can click on the page URL to add a new post. Refreshing will not work because the form adds some parameters to the URL.
-
AuthorPosts