Posts Tagged ‘Wordpress’

PostMash Custom — custom post order for custom post types


Drag’n’drop reorder­ing of posts, now also for cus­tom post types and taxonomies!

You might know the plu­gin Post­Mash, and its spin­off Post­Mash (fil­tered). Both very nice plu­g­ins, allow­ing drag’n’drop reorder­ing of posts. Espe­cially for those of us using Word­Press as a CMS this is a very nice fea­ture to offer our web­de­sign clients. But time went by, and nei­ther plu­gin were ever updated for Cus­tom Post types / Cus­tom tax­onomies, as intro­duced in WP 3.0. Enter Post­Mash Custom!

The new cus­tom post types and cus­tom tax­on­omy fea­tures intro­duced in WP 3.0 boosted WP’s capa­bil­i­ties as a CMS to a whole new level, and I quickly started using these new fea­tures for my web­de­sign clients, mak­ing event cal­en­dars, port­fo­lio sites and lots of other fea­tures a lot eas­ier to use, and more depend­able and eas­ier to cus­tomize than bee­ing depen­dent on plu­g­ins for every lit­tle fea­ture. But drag’n’drop sort­ing of posts were sorely missed.

So, finally I had to do get some­thing done myself. Here is the result — free for all:

Post­Mash Custom

Down­load post­mash custom

How to use:

Usage is exactly the same as its pre­de­ce­ces­sors postMash/filtered, so if you know/use those, you can just switch with this with­out any fur­ther work.

For every­one else: Unzip and upload to wp-content/plugins using your favorite FTP client, then acti­vate in Word­Press’ admin-area.

Then — in your theme’s index.php-file (or whereever you want to use it), find the begin­ning of “the loop”, start­ing with


Directly before that, add the fol­low­ing code:

    $wp_query->set('orderby', 'menu_order');
    $wp_query->set('order', 'ASC');

This just tells WP to get the posts ordered accord­ing to their “menu_order” posi­tion. There­fore you can get the posts ordered any­time you use a func­tion such as get_posts sim­ply by giv­ing it the required arguments:

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

Instruc­tions for Twenty Ten

Things may seem a bit dif­fer­ent in Twenty Ten, since the loop has been moved from the indi­vid­ual tem­plate­files into loop.php, but actu­ally it still works almost exactly the same. Below is the entire code you need for Twenty Tens index.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">
    $wp_query->set('orderby', 'menu_order');
    $wp_query->set('order', 'ASC');
			/* 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(); ?>

More info in the readme in the zip. The plu­gin will also be added to WP’s repos­i­tory asap. The plu­gin can now be down­loaded at http://wordpress.org/extend/plugins/postmash-custom/