Forum Replies Created
-
AuthorPosts
-
Peter
ModeratorHello Md Wasim,
I will take care of this topic from now. On the archive page, you can use the WordPress function get_queried_object_id() to get the term ID and pass it to the helper function
rwmb_meta()as you do above.$term_id = get_queried_object_id() $image_id = rwmb_meta( 'author_single_image', $args, $term_id );November 3, 2022 at 10:11 PM in reply to: ✅Possible to template_lock MB Block and still allow other blocks to be added? #38951Peter
ModeratorHello Jacob,
It looks like you want to add one instance of MB test block on a post/page and allow other blocks added. Please use the setting
supportswithmultipleset tofalse.'supports' => [ // Use the block just once per post multiple: false, ],Peter
ModeratorHello there,
It is not possible to render the frontend shortcode via AJAX call because the CSS and JS files will not be loaded along with the HTML code. Please use the shortcode on the page load only to make the shortcode render correctly.
November 3, 2022 at 9:24 PM in reply to: ✅MB Toolset Migration not working in "Post Reference" field #38949Peter
ModeratorHello Jason,
Thanks for following up.
The issue has been added to the development queue and our team will work on this in a short time. I will keep you updated on this issue.
Peter
ModeratorHello Jimimac,
A similar code works as well on my local site
$loop = new WP_Query( array( 'post_type' => 'page', 'posts_per_page' => 5, 'order' => 'ASC' ) ); while ( $loop->have_posts() ) : $loop->the_post(); echo the_title(); echo '<br/>'; $contacts = MB_Relationships_API::get_connected( [ 'id' => 'page-to-post', 'from' => get_the_ID(), ] ); foreach ( $contacts as $c ) { echo $c->post_title; } endwhile; wp_reset_postdata();so please recheck the relationship ID and the
fromside when registering the relationship on your site.Peter
ModeratorAfter a post is submitted successfully on the frontend, the custom field value is already saved to the custom table (if you choose to save the custom table), not waiting to approve. Then it is not possible to move the field value to the default table
wp_postmetabecause the field is registered to get the value from the custom table.Peter
ModeratorHello Chris,
You can use this PHP code to remove the editor if you want
// Remove the editor. Change 'post' to your custom post type. add_action( 'init', function () { remove_post_type_support( 'post', 'editor' ); } );Read more on the documentation https://docs.metabox.io/save-wysiwyg-content-post-content/
Peter
ModeratorHello,
Can you please check the value in the database if the field saved the correct value? If not, please share the PHP code that registers the user meta field, I will try to reproduce the issue on my demo site.
Peter
ModeratorHello there,
There is an error when using the single quote in your code, it should be
echo do_shortcode('[mb_frontend_form id="url" post_fields="title,content"]');Peter
ModeratorHello Amy,
To manually review the post before publishing it, you can simply use the attribute
post_statusof the frontend form shortcode[mb_frontend_form id="field-group-id" post_fields="title,content" post_status="pending"].If you want to do something after saving the post, please try to use the hook
rwmb_frontend_after_save_postorrwmb_frontend_after_processPeter
ModeratorHello there,
If you set the field
image_advancedas a cloneable field, you will need to use 2 for loop to get the image ids. Here is an example:$advanced_images = rwmb_meta( 'image_advanced_wyyzp67zec' ); $image_ids = []; foreach ( $advanced_images as $advanced_image ) { foreach ( $advanced_image as $key => $image ) { array_push( $image_ids, $key ); } } $shortcode = '[' . 'gallery ids="' . implode( ',', $image_ids ) . '" itemtag="div" icontag ="div" size="thumbnail" link="file"]';Peter
ModeratorHello Yasmine,
Can you please let me know the full scenario in this case? If you use this code
$term_id = get_queried_object_id(); $value = rwmb_meta( $my_custom_field_id, ['object_type' => 'term'], $term_id );It will work on the archive term page and get the term meta. But you also refer to this code
$was_interview = get_post_meta( $post->ID, 'summary-made', true );which only works on the post page or in the WP Query loop.
Peter
ModeratorHello there,
Currently, MB Block does not support passing data to a function to render the custom block like that. I will inform the development team to explore the possibility.
-
AuthorPosts