Create Mash Up

Home Forums MapPress Support Create Mash Up

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #14228
    hawkesley
    Participant

    I am trying to create a mash up of my maps to create a mashup.
    i have tried the short code in my page template which shows a world map and no POI’s. e.g.<?php echo do_shortcode(‘[mashup]‘); ?>
    My maps are created from a custom field that is set up in the Geo Settings and is post code.
    this generates the maps which i can display individually using the following$result =$wpdb->get_results(“SELECT map_id
    FROM sw_postcode
    WHERE post_code = ‘$post_code'”);
    foreach( $result as $results )
    {

    $map_id=$results->map_id;
    }

    echo do_shortcode(‘[mappress mapid="'.$map_id.'"]‘);
    }
    How can I use the map id to create a mash up please.

    #14230
    Chris
    Keymaster

    Hi,

    It’s easier to create mashups is by using a category or tag, if that’s a possibility for your site.

    If not, to use specific maps, you’ll need to use post ID or page ID – there’s no way to query by map ID.

    For example:
    [mashup query="p=1,2,3,4"]

    Or for pages:
    [mashup query="page_id=1,2,3,4"]

    #14238
    hawkesley
    Participant

    Thanks.
    I dont use categories or tags.When the map is created I have a post form gravity forms to which I could add category or tag or post type.
    How would I then produce a mash up?

    #14242
    Chris
    Keymaster

    See the documentation for some examples of mashups using queries based on categories and tags.
    http://mappresspro.com/mappress-documentation

    WordPress has some more here:
    http://codex.wordpress.org/Class_Reference/WP_Query

    As I mentioned above you can also do post IDs, but I think categories or tags might be easier.

    #14246
    hawkesley
    Participant

    Thanks for that.
    I tried the following thinking if I could get a straight forewarns mash up I could move from there.:-
    <?php echo do_shortcode(‘[mashup query="p=259,261"]‘);?>
    which gave me one POI on the map and not two.
    The maps are valid as ordinary posts with the maps inserted in the posts and the data is in the posts database.
    How to debug/fix?

    #14253
    Chris
    Keymaster

    Sorry, I forgot – the p= query is only for a single post.

    You need post__in. Here’s the example from the documentation:

    [mashup query="post__in=3,4,5"]

    #14277
    hawkesley
    Participant

    Thanks Chris, that works.
    Can you tell me how the Mash Up query works or point me to the code.
    My gravity form gives a post id and this is referenced in the map press posts table so I am wondering if I can amend the query a little.
    Thank you.

    #14285
    Chris
    Keymaster

    Hi, you can see the code in mappress_pro.php. The plugin uses the standard WP_Query class to read the posts, then combines the POIs from the maps attached to those posts into a single map.

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