I am trying to:
- to keep predefined sort options, when I sort products in a specific way. Therefore, when I use a filter, products should be still sorted as defined. For sorting, I use a custom (Number) field for a full sort control.
Instead, I got:
- Instead, products are sorted randomly
After I tested different sort settings options I found that sort brokes always, when I chose options without page reloading. (Screenshot of an example of settings when I observe an issue you can find in the attachment)
Link to a page where the issue can be seen: versteckter Link
Hi, can you try the following troubleshooting steps first?
- Temporarily switch to a default theme like Twenty Seventeen or Twenty Nineteen. Deactivate all plugins except Types and Views. If you want to activate a Maintenance Mode plugin for testing, that's fine.
- Test again. If sort is working as expected, reactivate your parent theme, then child theme, then other plugins, one by one until the problem returns. Try to isolate a single component that is causing this conflict.
- If the sort is still not working as expected, check the Ordering settings for this View and confirm that you are sorting as a number, not a string or native custom field. Screenshot attached.
Hi Christian.
Thank you for your advice.
I tested with deactivation of plugins and changing themes. I have found that issue with a sort appears when I activate
Post Types Order plugin: https://wordpress.org/plugins/post-types-order/
I used this plugin to change an order of posts and the way how users move from post to post using "Previous/Next" links (in the single post). Page link here: versteckter Link
Previously, without that plugin, even if I used alphabetic sort from Toolset, "Previous/Next" would lead not to the previous or next post (by alphabetic sort), but to posts with a higher/lower post ID.
If I can't use the Post Types Order plugin, what another solution you could suggest?
Thank you
I don't know of a simple solution to create next and previous post links automatically based on alphabetical order of post titles. That would require some fairly complex custom code. However, if you have a numeric custom field set up already for determining sort order, you could use that field with Views to display custom "Next" and "Previous" links instead.
- Create a View and choose "Full custom display" in the popup. This View will display your "previous" post link, so name it something relevant.
- Choose this post type in the Content Selection area.
- Order the View by your sorting custom field, as a number, in descending order.
- Check "Don't include current page in query result".
- Set a limit of 1 post, with no offset.
- Add a Query Filter, filtered by the custom field, as a number, where the results are lower than or equal to a shortcode attribute "current" (see query-filter-1.png).
- In the Loop editor, click "Skip wizard" to skip the Loop Wizard tool. Insert a post title with link shortcode inside the wpv-loop tags. You can add some text that says "Previous post: " or whatever you want to say before the wpv-post-link shortcode.
- Remove all the content from the no items found section.
- Insert this View in your post template and add the "current" shortcode attribute. Set the value of the current attribute using the raw custom field value from the current post, like this:
- Repeat this process to create a second View that will be used to display the "next" post link. In this View, use ascending order instead of descending order, and set the Query Filter to be greater than or equal to the shortcode attribute "current".
- Insert this View in your post template and add the "current" shortcode, just like you did with the other View.
Let me know if you run into problems and I can take a closer look.