Hi!
I created a view and i cant order by name the categories.
I add the filter:
[wpv-control-post-taxonomy taxonomy="category" type="checkboxes" format="%%NAME%%" class="wpv-category" style="border-radius:40px;" url_param="wpv-category"]
I need to order by name the categories.
Can you help me?
Thank you
Hello, it sounds like you want to change the sort order of the category filter terms in a custom search View. The default sort order for a category filter is sorted by term name ASC:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-control-post-taxonomy
So the shortcode you have here seems to be set up appropriately for sorting by term name, in ascending order. If the order is not sorted by name, there could be interference from another theme, plugin, or custom code snippet. As a test, you can try these troubleshooting steps:
- Temporarily activate a default theme like Twenty Twenty one
- Temporarily deactivate all plugins except Types and Views (or Blocks)
- Temporarily deactivate all custom code snippets in Toolset > Settings > Custom Code
- Temporarily deactivate all custom JS code in the View editor screen
- Test again
- If the problem is resolved, reactivate your theme, other plugins, and custom code snippets one by one until the problem returns
- If the problem is not resolved, please provide a URL where I can see the problem
Hello Christian,
I modified the code and didnt work:: [wpv-control-post-taxonomy taxonomy="category" type="checkboxes" format="%%NAME%%" order="ASC" orderby="name" class="wpv-category" style="border-radius:40px;" url_param="wpv-category"]
I tried your steps and the problem is not resolved.
- Temporarily activate a default theme like Twenty Twenty one (Not work)
- Temporarily deactivate all plugins except Types and Views (or Blocks) (Not work)
- Temporarily deactivate all custom code snippets in Toolset > Settings > Custom Code (Not work)
- Temporarily deactivate all custom JS code in the View editor screen (Not work)
- Test again
I want order by name categories on checkboxes below 'filtra por sector':
URL: enlace oculto
Thanks!
It seems I need a login to see this page. Can you provide login credentials please?
Maybe I don't understand the problem? I only see one option in the Category checkboxes filter: "Uncategorized". I also see some JavaScript error on the page:
Uncaught SyntaxError: Identifier 'hide_test' has already been declared
Am I supposed to see more options besides "Uncategorized"?
Hi,
Yes, there are more options available.
You entry on english section.
If you switch to spanish section, you will see all options.
Okay I see, thank you. The issue here is that Views sorts the filter options from a hierarchical taxonomy based on alphabetic sorting of the top-level terms, and preserves the hierarchy of descendents within those top-level terms. So what you're seeing in the filters now reflects the hierarchical organization you can find in the Categorías page in wp-admin here:
enlace oculto
Unfortunately I don't think there is a simple solution here. I suspect the most practical way to handle this right now is to use custom JavaScript code to manipulate the order of the filter options programmatically when the page loads. Something like this example:
https://www.w3schools.com/howto/howto_js_sort_list.asp