Custom Fields
Re-Envisioned
Support Meta Box Builder retrieving image in post from new field

  • Creator
    Topic
  • #23604
    Resolved Steve
    Participant

    Hi, I have purchased meta box builder and I have added file upload as a new file and it works fine, however im using the grid template builder with WPbakery page builder and I have added a custom field and in the input I have tried adding both the ID of the new metafield and also this shortcode [rwmb_meta id="single_image_ngobiqx24ya"] but neither seem to be pulling the image from the new field, are you able to advise? thank you.

Viewing 10 replies - 1 through 10 (of 18 total)
  • Author
    Replies
  • #23605
    Long Nguyen
    Moderator

    Hi Steve,

    WPBakery is a premium plugin so I've not checked the shortcode with this builder before. Please share a copy of this plugin via the contact form https://metabox.io/contact/, I will test the shortcode on my end.

    FYI, I also test the shortcode with Elementor and it works as well.

    #23606
    Steve
    Participant

    Hi Long, Thanks for getting back to me. I cannot send you the plugin as this is art of a theme bundle, i can send you the login credentials though so you can try yourself, I tried adding the shortcode directly to the page but nothing is displaying. Is it possible to send a private reply on here with the login details?

    #23609
    Steve
    Participant

    Also just to mention the field type I added is "single image" im not sure if this makes a difference to my shortcode?

    #23617
    Long Nguyen
    Moderator

    Hi,

    This is a public forum so you should share the login credentials via this form https://metabox.io/contact/.

    #23633
    Steve
    Participant

    Thanks Long I just sent the login details via the contact form, please confirm receipt of this information.

    #23638
    Long Nguyen
    Moderator

    Got the issue. You've added the prefix for the field ID, screenshot https://share.getcloudapp.com/DOuodQb7.

    So the field ID when using the shortcode is flipimagesingle_image_ngobiqx24ya. Get more details in the tab Code of Field Groups.

    
    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $prefix = 'flipimage';
    
        $meta_boxes[] = [
            'title'      => esc_html__( 'Flip Image', 'text-domain' ),
            'id'         => 'flip-image',
            'post_types' => ['post', 'portfolio'],
            'context'    => 'side',
            'priority'   => 'low',
            'fields'     => [
                [
                    'id'   => $prefix . 'single_image_ngobiqx24ya', //here
                    'type' => 'single_image',
                    'name' => esc_html__( 'Single Image', 'text-domain' ),
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    #23640
    Steve
    Participant

    Thank you! where did you add this function code as I will be happy to just remove the prefix to make it easier.

    #23648
    Long Nguyen
    Moderator

    Hi,

    The PHP code is generated by the Builder, you can share it with other sites that do not have the MB Builder extension. And I've checked the code to see the settings of the meta box and custom fields. You can learn to use it in the documentation https://docs.metabox.io/extensions/meta-box-builder/#getting-php-code.

    #23671
    Steve
    Participant

    Hi Long, how can I pass the post ID to the shortcode dynamically so the grid can associate the correct post ID in each shortcode/post?

    #23698
    Steve
    Participant

    Hi Long, I hope you’re well. are you able to get back to me on the last message?

Viewing 10 replies - 1 through 10 (of 18 total)
  • You must be logged in to reply to this topic.