Custom Fields
Re-Envisioned
Support General Displaying the map with a shortcode

  • Creator
    Topic
  • #31378
    Natalia
    Participant

    Hi! I have a custom post type in WP and posts have location added via "Google maps" metabox. I want to display a map from one of the posts on a page other than the single post. How can I do this with a shortcode?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #31384
    Long Nguyen
    Moderator

    Hi Natalia,

    Please follow this documentation to use the helper shortcode [rwmb_meta] https://docs.metabox.io/shortcode/

    You need to pass the post ID to the shortcode to show a map from a post on a page.

    [rwmb_meta id="map_field_id" object_id="15"]
    
    #31392
    Natalia
    Participant

    Thank you 🙂 And is it possible to add args in shortcode, especially zoom?

    #31402
    Long Nguyen
    Moderator

    Yes, it is possible. You can add args to the shortcode as the attributes, like this

    [rwmb_meta id="map_field_id" zoom="5"]
    

    Note: you can pass other attributes to the shortcode if you want. If you do so, those attributes will be passed to rwmb_the_value() function as the 2nd parameter.

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