WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

PostMash Custom - custom post order

Customize display order of posts by a simple drag-and-drop Ajax interface, now with support for custom post types and custom taxonomies.

Upload to wp-content/plugins/ and activate.

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 ‘menu_order’ position. Therefore you can get the posts ordered anytime you use a function such as get_posts simply by giving it the required arguments:

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

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

Instructions for Twenty Ten

Things may seem a bit different in Twenty Ten, since the loop has been moved from the individual templatefiles into loop.php, but actually it still works almost exactly the same. Below is the entire code you need for Twenty Tens index.php:

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>

        <div id="container">
            <div id="content" role="main">
<?php  
    $wp_query->set('orderby', 'menu_order');  
    $wp_query->set('order', 'ASC');  
    $wp_query->get_posts();  
?>
            <?php
            /* Run the loop to output the posts.
             * If you want to overload this in a child theme then include a file
             * called loop-index.php and that will be used instead.
             */
             get_template_part( 'loop', 'index' );
            ?>
            </div><!-- #content -->
        </div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

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';
    }

Requires: 3.0 or higher
Compatible up to: 3.1.4
Last Updated: 2011-3-3
Downloads: 20,143

Ratings

4 stars
4.2 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,2,2
100,1,1 0,1,0 0,1,0 50,4,2
100,2,2
100,1,1
100,1,1
43,7,3
100,1,1
33,3,1
100,1,1
100,1,1
0,1,0