Documentation - Getting Started - Bad vs Good Practice when set-up Sort Lists

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

Bad vs Good Practice when set-up Sort Lists

The Advanced Post Types Order plugin offers a flexible way to sort any area of your website. However, ensuring that sort lists are set up correctly is crucial to maintaining an organized and efficient ordering system.

Common Pitfalls to Avoid

One of the most common bad practices is the creation of multiple simple sort lists for the same post type, differentiated only by taxonomy terms. For example, an administrator might create separate sort lists for a “Product” post type by selecting different categories like Accessories, Electronics, and Books.

category-selection

Why is this a Bad Practice?

When multiple sort lists are created for the same post type and configured similarly, it can lead to conflicts and ambiguity. The plugin can only apply one sorting order, and if there are multiple sort lists with the same settings, only the first one will be used. This can cause confusion and unexpected results. To help users identify this issue, the plugin displays a notice message:

sort-list-notice

 

Best Practices for Setting Up Sort Lists

1. Use a Single Sort List with Category Selection

A good practice in the scenario described above is to create a single sort list for the “Product” post type and utilize the category selection, under the large blue arrow, to manage the order within each taxonomy term. Here’s how to do it:

  • Step 1: Create a sort list for the “Product” post type.
  • Step 2: Select a category, such as Accessories, and customize the sort order.
  • Step 3: Update the order list.
  • Step 4: Select the next category, such as Electronics, and adjust the order accordingly.

This approach ensures that only one sort list is used, reducing the risk of conflicts and making it easier to manage and update orders across different categories.

2. Use Conditionals for Multiple Sort Lists

If you need multiple sort lists of the same type to apply to different sections of your website, you should use conditionals to narrow down where each sort list is applied. This ensures that each sort list only affects the intended area of your site. For more information on setting up conditionals, refer to the Using Conditionals for Sorting Application guide.

3. Consider Creating an Advanced Sort List

Another good practice is to create an advanced sort list by selecting both the post type and taxonomy term. Advanced sort lists are prioritized over simple sorts, meaning they will be checked first when determining the sort order. However, if you need to sort a large number of terms, using simple sort lists might be more efficient, as it avoids the need to create multiple advanced sort list for each term.

advanced-sort-settings

By following these best practices, you can avoid common pitfalls and ensure that your sort lists are both effective and easy to manage. Whether you’re working with a simple or advanced sorting setup, thoughtful planning and proper configuration will help you maintain an organized and efficient content structure across your website.