June 26, 2015 at 8:32 am #15930
Trying to integrate mappress with a custom post type on this site: http://ruralswal2015.staging.wpengine.com/types/auburn-rural-studio-2/
Currently using this <?php echo do_shortcode(‘[mashup hideempty="true" width="100%" height="350px"]‘); ?> to call the map. It works perfectly in that it pulls the 10 locations listed below it on a page. How can I have it pull all of the locations under a taxonomy instead of only the ones on the actual page? (I would like it to show all 55 locations, for example, on the first page of the map–and continue to display them all on subsequent archives.) This shortcode is inserted into the archive.php file, by the way. Thanks for your help! (if I inadvertently submitted this twice, please forgive me)June 26, 2015 at 8:47 am #15931
If the posts are all assigned to a specific category/tag the easiest way to do this is to use a mashup for that category/tag with posts_per_page=-1. There are some examples in the documentation:
If you don’t know the category/tag being in advance I’ve recently added a way to include the URL request variables in a query. Just prefix the variable with ‘@’. For example, to show all posts in the current category use:
I hope that helps!August 10, 2015 at 8:34 am #16103
Sorry to be so slow in getting back to you with this. And thanks for your quick response before. I’m not sure what I’m doing wrong here. Perhaps it is a simple as not including the correct nomenclature. I have a custom post type called “sites” and in that I have three hierarchical taxonomies: “trails,” “Counties,” and “Seasons”.
Currently, the map shows up at the top of any archive page for this custom post type and displays the 12 custom post type “sites” associated with that archive. When I go to page 2, it correctly displays the next 12 locations.
What I want it to do is to display all of the sites associated with a specific hierarchical taxonomy (be it trails, counties, seasons or, I guess, one I haven’t come up with yet) in the archive.
Can you help me with this? Sorry for the long-windedness.
JoeAugust 10, 2015 at 8:44 am #16104
The query you were using just shows the currents posts, so you’ll need a ‘query’ parameter to tell the plugin what to select from the database.
For example, this should show *all* trails:
The other taxonomies should work the same way, but let me know if I’m missing something.August 10, 2015 at 9:07 am #16105
Thanks for the quick response. What I’m hoping is to not have to specify the name “trail” etc. Instead, have the map load all the content from a taxonomy based on what is populating the archive below. Say, someone hits a specific trail in the archive, it would show all 34 locations along the trail on the map, but display only the first 12 locations on the page, until the user went to page 2, where it would display all the same locations on the map, but only the next 12 locations below. Does that make sense?
The issue is this: people visit the page and look at the map only. They don’t bother to scroll down or to go to page 2. And that leaves multiple locations unvisited. Thanks,
JoeAugust 10, 2015 at 9:12 am #16106
I gave an example of doing the mashup for all the posts in the current category. For category, the query variable is ‘cat’. It should be set when WordPress displays an archive of posts for that category.
For custom taxonomies, the query variable is usually the same as the taxonomy. So the mashup to show all posts for the current trail is:
[mashup query="trail=@trail&posts_per_page=-1"]August 10, 2015 at 9:45 am #16107
That does pull all the posts within the category. Is there some way to get it to only pull the posts that the archive is currently showing? The example above pulls all 270 locations no matter what section you are looking at. For instance, I visit here: http://birdtrail2015.staging.wpengine.com/counties/calhoun/ and I see all 270 sites. But, there are actually only 4 locations in this section. Thanks! But I don’t have pages built for each taxonomy term–it is handle through the archive.php file.August 10, 2015 at 9:55 am #16108
The should pull in the current taxonomy, but ‘trail’ is blank on that page. It doesn’t look like an archive page for a trail. Maybe a ‘county’ query would work better on that page, to show all the trails in a county:
Also, you may want to confirm that the query variables do have the same name as the taxonomy (it’s possible for them to be different). You’d need to find the register_taxonomy call that was used to register them – there’s some info here:August 10, 2015 at 10:18 am #16109
Thanks. I’ll try to do a little more digging into this. I’m not really a strong coder. I can hack around a bit, but a full grasp is probably out of my league. Even when I uses the above mashup on this page http://birdtrail2015.staging.wpengine.com/trails/appalachian-highlands/ I get all the locations in the system. Just for background: there are 8 trails with a total of 270 locations. The trails range from 2-15 counties each with anywhere from 20 locations to 50 locations. I have one archive.php file that is dynamically pulling all of this together depending on what someone is looking for on the front end. (I’ve used the wp-types Views and Types plugins to do this). Thanks again for your help. You really do have the best mapping plugin that I’ve found–by a long, long shot.August 10, 2015 at 10:20 am #16110
Sounds good – one thing to try is maybe use ‘trails’ instead of ‘trail’. From the site it looks like maybe the taxonomy is registered under the plural, so this might work:
[mashup query="trails=@trails&posts_per_page=-1"]August 11, 2015 at 3:10 am #16111
That works beautifully when visiting a “trails” page. Thank you so much. But, when visiting a “counties” page or a “seasons” page, it displays all the sites again. Anyway to wrangle all these into one mashup possibility?August 11, 2015 at 3:14 am #16115
Hmmm… honestly, I don’t know. You could use 3 separate mashups (one for each taxonomy archive), just replace ‘trails’ with ‘county’ or ‘season’ (or whatever query variable they’re registered with).
It might also work to use one mashup for all three:
[mashup query="trails=@trails&county=@county&season=@season&posts_per_page=-1"]August 11, 2015 at 3:31 am #16116
Okay, you rock! This works. Thanks so much! This is awesome!!!!! Thanks again!
- You must be logged in to reply to this topic.