get_categories alphabetic order, no matter what
-
After updating the WordPress install of a client of mine we saw that the get_categories() function for some reason kept returning everything in alphabetic order. On a normal blog that may not be a problem, but since the main-categories were area’s in the Netherlands and the subcategories were places in those area’s that gave a very weird result (so, all categories were in alphabetic order, sub and main categories were mixed).
I did have hierarchical set to 1, even copied the word from the codex to be sure I didn’t make a typing error, but the results were the same: no hierarchical list but an alphabetic list.An example:
- Amsterdam
- Buitenveldert
- IJburg
- Watergraafsmeer
- Zeeburg
- Surrounding Area’s
- Almere
- Badhoevedorp
- Vinkenveen
- Zaandam
The above is what we wanted to get (and the indenting etc. was done by other HTML, the indenting etc. above is just to show which categories are main/sub categories).
This is what we got:- Almere
- Amsterdam
- Badhoevedorp
- Buitenveldert
- IJburg
- Surrounding Area’s
- Vinkenveen
- Watergraafsmeer
- Zaandam
- Zeeburg
I had to add a function to functions.php and call that per main category in order to make it display as we wanted.
Are there more people having issues like this?
- The topic ‘get_categories alphabetic order, no matter what’ is closed to new replies.