Support › General › Displaying the map with a shortcode
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?
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"]
Thank you 🙂 And is it possible to add args in shortcode, especially zoom?
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.