retrieving image in post from new field

Support MB Builder retrieving image in post from new fieldResolved

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #23719
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Shortcode is a shortcut code that helps you run the helper function rwmb_meta without touching the code, it uses to display the field value for a specific case/post.

    If you want to show the field value of all posts (portfolios) in a shortcode, please create a custom shortcode to show all portfolios and its custom field. Follow this documentation https://codex.wordpress.org/Shortcode_API.

    #23741
    SteveSteve
    Participant

    Thanks Long but this does not explain how we pull the postID from each object automatically, can you please advise how we can add the postID to a Metabox custom field automatically?

    #23811
    SteveSteve
    Participant

    Im using this shortcode to display a single image: [rwmb_meta id="field_id" object_id="15"]

    how would I add a class to this image via the shortcode?

    #23813
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The shortcode does not support to add the custom class. You can try to wrap the shortcode in a <div> tag. Just like:

    <div class="my-custom-class">
        [rwmb_meta id="field_id" object_id="15"]
    </div>
    

    Or use the Builder to add the custom class to the field https://share.getcloudapp.com/X6u0nXzj.

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.