Home › Forums › MapPress Support › Sort mashup POIs by date
- This topic has 5 replies, 3 voices, and was last updated 13 years, 2 months ago by
Chris.
-
AuthorPosts
-
June 16, 2013 at 6:55 am #12825
Hi,
I’m a MapPress Pro user and I’m trying to sort POIs on the mashup by descending date order (i.e. newest posts first).
I’ve tried the documentation, e.g. here http://mappresspro.com/mappress-documentation#toc-custom-sorting, but am struggling to make it happen.
Any ideas?
Thanks for an excellent plugin – it’s working brilliantly.
Tom
June 17, 2013 at 12:49 am #12828Hi Tom,
The easiest way is probably to use the ‘orderby’ parameter in your query (then you don’t need a filter).
See here for some examples:
http://codex.wordpress.org/Class_Reference/WP_QueryFor example to order posts by date, descending, this should work:
[mashup query="orderby=date&order=DESC"]June 17, 2013 at 1:05 am #12830Hi Chris,
Thanks for your reply, much appreciated. This doesn’t seem to work if I also include a post-type query, e.g….
<?php echo do_shortcode('[mashup query="post_type=uk&orderby=date&order=desc" sort="false" width="99%" height="450"]'); ?>I’m probably missing something obvious. Any ideas?
Thanks,
TomJune 19, 2013 at 6:55 am #12855Hi,
I don’t see why the custom post type would affect the query orderby.
If the query is invalid (for example, wrong post type) WordPress would revert to a default query posts by date descending, so double-check the post type you’re using is valid.
You can also try this code (add it to a theme file) – it should show what posts WordPress is selecting without using MapPress at all:
<?php $wpq = new WP_Query('post_type=uk&orderby=date&order=desc'); print_r($wpq); ?>Finally, try disabling your other plugins and switching to a standard theme for a moment. Some themes/plugins modify the WordPress query.
June 19, 2013 at 1:25 pm #12861Custom post types are working – I’m using them 😉
June 19, 2013 at 3:34 pm #12866Hi,
Yes, custom post types should work – but I thought you were saying you didn’t get any query results when you combine a post_type and orderby in the query?
If there are no results, try the code and see what WordPress is returning (without using MapPress). You can post the results here and I’ll take a look if that helps.
-
AuthorPosts
- You must be logged in to reply to this topic.
