Support » Plugin: Reorder Posts » (almost) perfect

  • JewelsSag


    This plugin is very good. Why ? Because it does exactly what it advertises and nothing more. Also, I like that the options page is actually in the settings submenu (quite rare nowadays).

    I often write my own plugins based on public plugins functions just to make them more tidy and less intrusive. Didn’t have to do anything with this one !

    Then, why ALMOST perfect ? Because there’s an option that I’d love to see (and, I think, should be here too) is to be able (should be an option) to display posts (in the admin posts list) in the order they were chosen using the plugin.
    If this features makes it in future update, be sure I’ll update this review to a 5 stars !

    Here’s how I’ve done it (sorting custom post type “videos” here) :

    function add_new_column($columns) {
        $columns['ordre'] = _x('Ordre', 'column name');
        return $columns;
    function custom_column( $column, $post_id = null ) {
        switch ( $column ) {
    		case 'ordre' :
    		    $terms = get_post_field( 'menu_order' , $post_id );
    	        if ( is_string( $terms ) )
    			    echo $terms;
    function custom_sortable_column( $columns ) {
        $columns['ordre'] = 'ordre';
        return $columns;
    function custom_column_width() {
        echo '<style type="text/css">';
        echo '.column-ordre { width: 10% !important; }';
        echo '</style>';
    function set_post_order( $wp_query ) {
    	$wp_query->set( 'orderby', 'menu_order' );
    	$wp_query->set( 'order', 'ASC' );
    function orderByReorder($postTypeSlug) {
    	global $pagenow;
    	add_filter( "manage_edit-{$postTypeSlug}_columns", 'add_new_column' );
    	add_filter( "manage_edit-{$postTypeSlug}_sortable_columns", 'custom_sortable_column' );
    	add_action( "manage_{$postTypeSlug}_posts_custom_column" , 'custom_column' );
    	add_action( "admin_head", 'custom_column_width' );
    	if ( is_admin() && 'edit.php' == $pagenow && $_GET['post_type'] == $postTypeSlug && !isset($_GET['orderby']))
    		add_filter( "pre_get_posts", 'set_post_order' );

    Thank you

  • The topic ‘(almost) perfect’ is closed to new replies.