Using Conditionals for sorting apply
The Advanced Post Types Order plugin offers powerful conditional logic to control when and where Custom Sorting is applied. By leveraging conditionals, you can ensure that your post order is only modified in specific scenarios, providing you with granular control over your content presentation.
What are Conditionals?
Conditionals in the context of the Advanced Post Types Order plugin are rules that define under what circumstances the automatic sorting should be applied. These conditions allow you to target specific pages, post types, URLs, or other criteria, ensuring that the sort order is adjusted only when the defined conditions are met.
Key Features:
- Granular Control: Apply sorting rules only under certain conditions, preventing unwanted reordering of posts in areas where a custom or different order is required.
- Multiple Conditional Groups: You can create multiple groups of conditions, each tailored to different scenarios. This flexibility allows for highly customizable sorting logic across your website.
- Diverse Conditional Types: Utilize a variety of condition types, including:
- Home: Apply sorting on the homepage.
- Page: Target specific pages by ID or slug.
- URL: Apply conditions based on specific URLs.
- Feed: Adjust sorting for RSS feeds or other custom feeds.
Conditional Comparisons:
Conditionals can be further refined using comparison operators, such as:
- Is / Is Not: Apply sorting if a condition is met or not met.
- Contains / Does Not Contain: Target elements within a condition, such as specific text in a URL.
Practical Use Cases:
- Homepage Customization: Automatically apply a specific post order on the homepage while leaving other pages unaffected.
- Per page Category-Specific Sorting: Use conditionals to apply different sorting rules for different pages with categories, ensuring each category page displays content in a relevant order.
- Dynamic Landing Pages: Tailor post order for landing pages based on URL parameters or page templates, optimizing content for specific audiences or campaigns.
Extending Conditionals
For advanced users, the plugin allows the creation of custom conditionals via filters. This feature provides developers with the ability to define new rules and logic beyond the default options, making the plugin adaptable to any unique requirement.
For detailed instructions on how to create custom conditionals, refer to the Create a New Sort Conditional guide.
Do you have a step-by-step tutorial for this? When I activated my Advanced version of the plugin, the sort order I created in “re-order” does not display. I then tried to make sense of the Conditional interface, but since I am not a coder, I’m sort of stuck here.
I suggest so you check first with those articles to better understand how sort list work
https://www.nsp-code.com/advanced-post-types-order-description-and-usage/create-sort-lists/
https://www.nsp-code.com/advanced-post-types-order-description-and-usage/understanding-sort-list-settings-area/
https://www.nsp-code.com/advanced-post-types-order-description-and-usage/create-simple-sort-for-a-custom-post-type/
Sorry, your tutorials are not working for me. I’ll send you a message via Contact Us to see if you can assist hands-on.
Thank you.
Sure, we can help.
Hi, let me try to get in touch this way.
I am trying to make a sort list for a category “Drinks”:
http://staging.imitzz.de/shop/drinks-shop/
I was able to do that with a taxonomy. But when I filter on “Tee” under “heiße Drinks”, the order of the products change again.
I want to make one sort list for an entire category, and keep that order when filtering further in the products.
Your colleague Dan said this was possible, but he isnt answering my mails for the last 2 months.
If this requires some custom code, that won’t be a problem, we are willing to pay for good support. Please respond asap.
With kind regards,
Coen