WordPress.org

Ready to get started?Download WordPress

Forums

Simple Page Ordering
Open Order Page by Default for Posts and CPTs (4 posts)

  1. blurb
    Member
    Posted 9 months ago #

    Hi,

    Does anyone know if there is a way to open the 'Sort By Order' view by default for posts and custom post types (just like it does for pages)?

    It would be very convenient to work with, especially for those of us that work with a lot of posts/custom posts.

    Thanks!

    http://wordpress.org/plugins/simple-page-ordering/

  2. mightypixel
    Member
    Posted 9 months ago #

    I managed to get the native support for custom post types (by making them hierarchical), but no luck for the default post type.

    Your ideas are much appreciated. Thanks.

  3. Andrew Tegenkamp
    Member
    Posted 8 months ago #

    I use this code to get it working for Pages and Custom Post Types (even if they are not hierarchical but support page-attributes) as this simulates clicking the "Sort by Order" button by default for these page types. I'm not sure what you mean by sorting posts by order since posts do not have order by default or even with this plugin as far as I know.

    function my_default_sort() {
    	//print_r($_GET); //debug to see what you got
    	$post_type = (isset($_GET['post_type'])) ? $_GET['post_type'] : '';
    	if ($post_type) {
    		if ($post_type == 'page' || $post_type == 'custom') {
    			if (!isset($_GET['orderby'])) $_GET['orderby'] = 'menu_order+title';
    		}
    	}
    	//print_r($_GET); //debug to see what you did
    }
    add_action( 'load-edit.php', 'my_default_sort' );

    Hope that helps!
    Andrew

  4. Eric Andrew Lewis
    Member
    Posted 7 months ago #

    I think this is an issue in core. See #26752

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.