Plugin Directory

postMash (filtered) - custom post order

To make use of this chosen order you will need to modify your template code: Open wp-content/themes/your-theme-name/index.php and find the beginning of ‘the loop’. Which will start: if(have_posts()). Then add the following code directly before this:

<?php  
    $wp_query->set('orderby', 'menu_order');  
    $wp_query->set('order', 'ASC');  
    $wp_query->get_posts();  
?>

This just tells WP to get the posts ordered according to their ‘menuorder’ position. Therefore you can get the posts ordered anytime you use a function such as getposts simply by giving it the required arguments:

<?php get_posts('orderby=menu_order&order=ASC'); ?>

Checkout the getposts() function in the wordpress codex for more info. Note that it says menuorder is only useful for pages, posts have a menu_order position too, it just isn’t used. postMash provides you with an iterface so that you can use it.

NEXT POST AND PREVIOUS POST LINKS

ALSO You can now use the 'Next Post' and 'Previous Post' calls in your template file 'single.php', as usual, but rather than calling items by date, it will call items using the same order as set in postMash, using the following modified commands in place of the regular tags

ORIGINAL TAGS

    next_post_link(); 
    previous_post_link();

MODIFIED TAGS

    next_post_link_menu(); 
    previous_post_link_menu();

(Please note that, by default, 'In Same Category' is set to TRUE. You will need to edit this if you wish to disable it. All other variables passed to the function should work as normal)

OPTIONAL ADMIN INSTALLATION

If you wish to view the posts in the Wordpress admin 'Edit Posts' panel in the same order as you have set them postMash (rather than the default 'Date Published' or 'Date Modified'), you can modify wp-admin/includes/post.php, on line 784 as follows;

ORIGINAL

    if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
        $order = 'ASC';
        $orderby = 'modified';
    } elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
        $order = 'DESC';
        $orderby = 'modified';
    } else {
        $order = 'DESC';
        $orderby = 'date';
    }


MODIFIED

    if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
        $order = 'ASC';
        $orderby = 'menu_order';
    } elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
        $order = 'ASC';
        $orderby = 'menu_order';
    } else {
        $order = 'ASC';
        $orderby = 'menu_order';
    }

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus

No data
100,1,1
100,1,1

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(7 ratings)