Custom Post Type - Ordering

43 views
Skip to first unread message

Cody Marx Bailey

unread,
Aug 4, 2010, 6:53:56 AM8/4/10
to wordpres...@googlegroups.com
Unfortunately, there's no way to order these posts using plugins like "My Page Order" on Custom Post Types. I need to be able to easily order about 80+ custom posts on a site, and while custom fields would allow me to set some sorta arbitrary order, it is very painful to keep things tidy. It's also very hard to manage as you have to go from item's full edit screen.

Does anyone know a way to setup some sorta interface to order Custom Post Types?

--
Cody Marx Bailey
979-574-9199
The Creative Space (.org)
Desired Hearts (.com)
Rock The Republic (.com)
Hashtags (.org)
423 S. Main St.
Bryan, Texas 77803

Paul

unread,
Aug 4, 2010, 9:20:18 AM8/4/10
to wordpres...@googlegroups.com
Actually this can be done. It's not pretty. If you are in a bind and just need to get this done you can hijack the MyPageOrder plugin to work with your Custom Post Type. The one caveat is you Custom Post Type must be based on Pages not Posts. In other words you should set the  'capability_type' => 'page' when setting up your Custom Post Type. For non-Page based Custom Post Types the order defaults to post_date like for Posts. 

Here are the steps to changing MyPageOrder for a one time use to order your 80+ items. 

1. First download, install and activate the MyPageOrder plugin. 

2. Next you will need to edit the plugin PHP code. All changes are made in one file /plugins/my-page-order/mypageorder.php. Once you have the PHP file open search for the term 'post_type'. You should find three references which is set to 'page'. Change this to your Custom Post Type. Then save the file. 

3. Now when you navigate to the My Page Order page under Pages you will see a listing of your Custom Post Types. 

Again this is a temporary solution. 

P-


--
You received this message because you are subscribed to the Google Groups "WordPress Austin" group.
To post to this group, send email to wordpres...@googlegroups.com
To unsubscribe from this group, send email to wordpress-aust...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/wordpress-austin?hl=en
 
Our meeting information is available at http://www.meetup.com/austinwordpress/

Cody Marx Bailey

unread,
Aug 4, 2010, 8:12:43 PM8/4/10
to wordpres...@googlegroups.com
Awesome. That worked. Looks like if I have multiple custom post types, I'll need to copy that plugin for each custom post type. Do you have any idea how to make the admin menu item show up in the particular custom post type expandable menu?

Paul

unread,
Aug 5, 2010, 8:06:17 AM8/5/10
to wordpres...@googlegroups.com
Cody,

Yeah was thinking that same. Again in the MyPageOrder plugin code mypageorder.php. At the very top is a function 

function mypageorder_menu()
{    
add_pages_page(__('My Page Order', 'mypageorder'), __('My Page Order', 'mypageorder'), 'edit_pages', 'mypageorder', 'mypageorder');
}

See the call to add_pages_page(). This is what adds the menu to the Page nav. So you will want to change this to something like 

function mypageorder_menu()
{    
//add_pages_page(__('My Page Order', 'mypageorder'), __('My Page Order', 'mypageorder'), 'edit_pages', 'mypageorder', 'mypageorder');

add_submenu_page( 'edit.php?post_type=xxx', 'XXX Order', 'XXX Order', 'manage_options', 'mypageorder', 'mypageorder' );

}


Notice in the parameters the first one contains 'post_type=xxx' This should have been changed previously to your own post type. The other parameters you will want to change which are the menu label and page name. 

Cheers,
Reply all
Reply to author
Forward
0 new messages