Reply To: Where does MapPress show up in The Loop?

Home Forums MapPress Support Where does MapPress show up in The Loop? Reply To: Where does MapPress show up in The Loop?



I’m assuming your actual parameters are [mashup show="current"] (‘display’ isn’t a valid argument).

To answer your question: the mashup uses the WP query global $wp_query. WordPress sets $wp_query to the current query for the page, based on the post/get parameters for the page. For show=’current’, MapPress reads the $wp_query object and loops through the posts. For each post it fetches the maps for that post using MapPress function get_post_map_list(). It then loops through the pois for each map and adds them to the mashup.

I think the problem is that the $wp_query global isn’t being set on your template. Using new WP_Query() won’t set it. So, MapPress is probably reading whatever was originally set for the page – which is probably empty.

If you use query_posts() instead of new WP_Query, WordPress will create the WP_Query object and then also overwrite the $wp_query global as well. The Codex has some explanation:

Some solutions might be:

1) Use query_posts() instead of creating a WP_Query object. I think this is the easiest, if it’ll work for you.

2) Explicitly use the same query in the mashup as you’re using in the template. It might be tricky if you’re paging results, but if you’re just displaying all the posts in a category it wouldn’t matter.

I hope that helps!