Best method to include post meta data in [map]

What is the best method to reference the map associated with a post from within the post content?

When you have a post with a custom field set up in google maps, the map is created automatically for mashup, however I want to display the map IN the post as well via [map] shortcode.

The [map id="VALUE"] value is stored in the agm_map_created meta data on the post, but I can not get a shortcode reference to the map ID to work. The problem is if I use a shortcode within a shortcode the [] brackets get confused, nd my attempts to use {} inset have been unsuccessful as well.

Is there another way I cann refer to the meta data attached to post (key:agm_map_created) to use and a value in [map id="value"]?

  • Patrick

    Hi there @jamie

    I hope you are having a great day!

    I guess it depends on how the shortcode you are wanting to add the map to is structured.

    Here's an example of a map inside a tab element in a post:
    http://patrickcohen.net/location-post/

    The plugin I'm using on that test site is Shortcodes Ultimate which does allow using other shortcodes as values in parameters too.

    What is the exact shortcode you are trying to use the map in, what parameter is the map value to be used for, and what plugin/script are you using to generate the shortcode?

  • jamie

    Thank you for the reply. Sorry for the dealy, been a busy season.

    I want to use the map shortcode like so:

    [map id="meta value for agm_map_created"]

    Where the "meta value from agm_map_created" is represented by a shortcode like [meta data]

    With psuedo code looking something like this:

    [map id="[meta data]"]

    Actual code looking like this:

    [map id="[meta name="your_meta_field"]"]

    All i get is "] because the shortcode terminates on the wrong closing bracket.

    I am using Meta Fetcher - https://wordpress.org/plugins/meta-fetcher/

    Don't go crazy on this, I think I need to create a custom shortcode that does not require a second value like name="", but rather just a [mapmeta] which has the value.

    I am looking into it, but have busy busy doing graphic work for another part of this project. If you have a solution, however, I am all ears.

    Thank you,

    Jamie

  • Ash

    Hello @jamie

    Please do not create multiple threads for same issue, rather continue in one thread. Can we close one thread please? :slight_smile:

    Would you please try any of these:

    [map id="[meta name=your_meta_field]"]
    [map id="[meta name='your_meta_field']"]
    [map id=[meta name=your_meta_field]]
    [map id='[meta name="your_meta_field"]']
    [map id=[meta name="your_meta_field"]]

    Please let us know :slight_smile:

    Cheers
    Ash