Custom Post Type Mashups (using toolset plugin)

Home Forums MapPress Support Custom Post Type Mashups (using toolset plugin)

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #12652

    I have built a site using the Toolset plugin:

    I have a page showing a loop of custom post types, “locations”, each of them has a map. I’m trying to get the mashup of all the post on the page and it doesn’t work.
    (sign in with “driver” password)

    I’m wondering if I am missing something? This is the code I’m using:

    [mashup width="98%" height="300" adaptive="true"]



    By default WP will only select post type ‘post’. You might try including the post type in your query:

    [mashup query="post_type=location&posts_per_page=-1"]

    Or just all post types:

    [mashup query="post_type=any&posts_per_page=-1"]


    Sorry to be so dumb… I figured it out.

    I had: query=”posts_per_page=-1&post_type=post”

    I changed it to: query=”posts_per_page=-1&post_type=location”

    Everything works fine!!!


    Also – for the current posts, try:

    [mashup query="current"]

    This will depend on your theme, plugins, etc. though – it will only work if the current global WordPress query ($wp_query) is set to the correct posts.


    OK… I have the map on the “locations page” working PERFECTLY! Thanks.

    Now I’m on the event page…

    The trick here is my events don’t actually have any map data associated with them. Instead they are “child-post” of locations.

    I have my “view” set up to display the map of the location on the event post… so I was hoping to be able to use the “current” and Mappress would see the “location” map within the event post and create a mashup on the top of the event list page.

    I’m afraid I’m fighting the “global WordPress query ($wp_query)” you mention above.

    I found a post on the Types and Views support forum where you chased this with another user, but I’m afraid it left me confused.

    How do I change the global WordPress query ($wp_query)?


    Hi, I don’t know – I don’t think there’s any easy way to display the parents of all the current posts.

    Maybe rather than showing just the current events you could show them all? Then you could use the event (parent) post type in the query. a lot of sites show everything on the map but just 1 page of results in the list.


    I can get the map of the location (the parent) to show up on the event listing (the child):

    (password is driver)

    But shouldn’t the mashup be showing all the maps on the page in the mashup map on the top?



    The mashup will show the results of the current page query, which is normally all the posts being displayed on the page. It won’t work if the query is empty.

    You can try printing out the current query – without the map – to see what’s being selected (just add this to your theme where the map would be):

      global $wp_query;

    I placed the code in the index.php file, (see image )

    It shows nothing on my event page, but it does on the blog home page.

    I’m thinking because the page was created with the Views plugin, it is using the views short code to display content and not the normal WP query.

    Not sure how to fix that…



    I don’t know if there’s a way to affect the regular query, you could ask the ‘views’ folks. If not, you can’t use ‘current’ in the mashup.

    You could set the mashup query to match whatever query ‘views’ is using. Or you could have the mashup display all locations in a category/tag/etc. rather than just the current sub-set.


    FYI… I got an answer from support on the Types and Views plugin and it worked perfectly:

    I created a custom shortcode to map the Views query to MapPress. The code is following, I added it to functions.php in your theme:

    add_shortcode('wpv-post-mashup', 'views_mashup');
    function views_mashup($atts) {
      global $WP_Views, $mappress;
      $atts['query'] = $WP_Views->post_query->query_vars;
      return $mappress->shortcode_mashup($atts);

    Then in your View you have to the shortcode like this [wpv-post-mashup width=”98%” height=”300″ adaptive=”true”]

    Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.


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