Create simple sort for a Custom Post Type

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPrint this page


Any order for your site are held by sort lists. Creating a simple sort for a Custom Post Type will allow to control the order for that particular post type across your theme, or just apply for certain areas in case of using Conditionals.

First access the Re-Order interface where you want to include the new sort. Click the + tab which allow to create a new sort:

advanced-post-types-order-interface-new-sort-tab

Set the required post type within the Sort List Settings. This will ensure the application will know what’s all about this sort and will apply the filters accordingly.

advanced-post-types-order-admin-interface-settings-post-types

Fill in the Title and Description then click Create. You can always come back later to change any of the sort settings.

Once the sort has been created a new area will append under the sort settings. This allows you to chose the content which you intend to be sorted (i.e. archive meaning all objects of this post type, a category, a term etc). Also a drag a drop list will show up with the posts.

There are two type of sorting, a manual and automatic. Manual sorting will allow an exact order to be specified through the drag and drop AJAX-ed interface, while Automatic can be used to automatize the sort process, meaning the code will take care of order update including for all new post objects which will be created. For more details check with Manual / Automatic sorting type usage

Once the order saved this will apply on front side. In case of using Auto Sort, no changes are required to your theme, the order is updated automatically for all query which match this sort. If Auto Sort is turned off, sort can be applied by including the ‘orderby’ => ‘menu_order’ within the query parameters, more details can be found at Sample Usage

API Index