Sort mashup POIs by date

Home Forums MapPress Support Sort mashup POIs by date

Tagged: , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12825
    thiskey
    Participant

    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

    #12828
    Chris
    Keymaster

    Hi 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_Query

    For example to order posts by date, descending, this should work:
    [mashup query=”orderby=date&order=DESC”]

    #12830
    thiskey
    Participant

    Hi 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,
    Tom

    #12855
    Chris
    Keymaster

    Hi,

    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.

    #12861
    CliveB
    Participant

    Custom post types are working – I’m using them 😉

    #12866
    Chris
    Keymaster

    Hi,

    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.

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