Tell us what you are trying to do?
I've entered taxonomy numbers from 1 - 26.
However, within the dropdown on the frontend form and on the backend, the order of these numbers are not, 1 2 3 4 5 6
It's ordering them like 1 10 11 12... 2 20 21 22.
Is there a way we can get these to order single digits and THEN double digits?
Is there a similar example that we can see?
Please see the screenshots
What is the link to your site?
The website is under development at the moment and isn't accessible to the public.
(You can specify that term meta be handled as numbers, but that doesn't apply here.)
I think the only real solution would be to edit the terms such that the slugs include preceding zeroes, e.g. 01,02,03 etc, though you can leave the display name without them.
I think the default order is based on the slugs, which would fix the problem, but if not it would be necessary to use the WordPress API to modify the relevant queries. (We can help with that if required.)
Planning ahead, if you are likely to add terms into the hundreds then you will want to include as many preceding zeroes as necessary, e.g. 001, 002, ... 010, 011, ... 100, 101 etc.
However, this post seems more towards the output of the content (as a finished product) on the front end.
However, I am trying to show this as;
1 Year
and
01 Year, will not look great when output onto the frontend. It isn't very friendly to the eye.
I did try a few things, like puting letters and zeros before the numbers within the slug of the taxonomy, however, it seems that the order is based off the name as apposed to the slug itself.
If there is another way you're able to possibly help with rectifying this for me, it would be amazing.
Thank you for your time so far!
I've added a screenshot of the desired finish on the front end.
I have tried it in my localhost, it works fine in both admin side and search form in frontend, if you need more assistance for it, please provide a test site with the same problem, I can setup a demo for you. Private message box enabled
It does work in your website, see here:
1) Admin side: hidden link
You need to order the result by taxonomy slug
2) In frontend: hidden link
You just need to find and select the "Year" taxonomy field, choose the options: order by taxonomy slug
see my screenshot tax-slug-order.JPG
However, I don’t use content templates or the block editor to style my front end.
I use elementor. So the option to order by slug sadly is not available for me.
Also, this doesn’t resolve the numbers showing incorrectly on the CRED form.
I’m guessing that it isn’t possible and I’m just going to have to put up with the numbers how they’ve ordered themselves.
It is the same steps to setup the post view with classic editor, I have setup another demo in your website:
1) Create a post view "Taxonomy numbers not correctly ordering 2" with classic editor: hidden link
filter by year taxonomy, and order the options by term slug, see my screenshot year-filter
2) Edit the previous page with Elementor editor: hidden link
add a "Toolset View" widget into content, choose above view
3) Test it in frontend, it works fine: hidden link
As much as this helps, it still doesn't fix my problem with the taxonomy on the CRED form showing incorrectly.
Your solution here will definitely help with my search settings using the legacy views, unfortunately, not for my actual form.
Is there anything at all I can do to have this show correctly within my CRED fom?
There isn't such kind of built-in feature to order the terms by slugs, so it needs custom codes, I have set a demo in your website:
1) Dashboard-> Toolset-> Settings-> Custom code, add one item " tax-year-left-orderby-slug", with below codes:
2) Create a page, display the post form "Admin add a new Holiday Home Form ", test it in frontend: hidden link
It works fine, see my screenshot term-order1.jpg
I have tried again in your website admin side: hidden link
It works fine in admin side too, see my screenshot term-order2.jpg