Bad vs Good Practice when set-up Sort Lists

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


Any area of website can be sorted using sort lists. As long they are set-up the right way, they will provide an easy way for customizing order.

A common Bad practice is to create multiple simple sort lists (see Create simple sort for a Custom Post Type) for the same post type, using a different taxonomy term. As example, for a Product post type, admin create a sort and select the category Accessories, then create another sort and chose another category Electronics, also another one called Books.

category-selection

This usually conclude to ambiguous situations as if there are multiple sorts of same type with same settings only the very first one will apply. The plugin output Notice message on such situation:

sort-list-notice

The Good Practice for above situation, would be to create a single sort list, and use the category selection to change the sort view and manage the order of items. For example, select Accessories, customize sort then Update order list. Following a selection to Electronics, the sort list will update allowing a sort customization for that area.

If multiple sort lists of same type are required, i.e. they will apply for different sections, conditionals should apply, to narrow down the sort apply (see Using Conditionals for sorting apply)

Another Good Practice would be to create an advanced sort list, by selecting the post type and taxonomy term. Such sort importance are higher than simple sorts, so they will be checked before others. Obliviously if you need to sort lots of terms, a simple sort will be a better solution as it will not require to create an advanced sort list for every term.

advanced-sort-settings

API Index