Home › Forums › Air WordPress Theme › air wp theme, custom filters order (not alphabetical)
- This topic has 3 replies, 2 voices, and was last updated 7 years, 11 months ago by
SeaTheme.
-
AuthorPosts
-
July 7, 2018 at 8:28 am #15680
Hello, I have some minor problems with Air customization.
Is there any way to create custom filters (based on catgories) order?
e.g. by default filters are like this:
all, jobs, print, sell, works,
and I wiould like to have this some other way, like:
all, works, prints, jobs, sell.
So its not alphabetical/reverse alphabetical order, but fully custom order.Regards, your’s theme-user
July 7, 2018 at 10:35 am #15681Hi,
There is not the option to order the filter item, you need to change the get_categories function :
/template/page/content-filter.php:The default order rule is category building time in line10-12.
$get_categories = get_categories(array( 'parent' => $category ));You could change the rule as categories name:
update as:$get_categories = get_categories(array( 'parent' => $category, 'orderby' => 'name', 'order' => 'ASC' ));you will go to Posts/Categories to change the categories slug name as 01works, 02prints, 03jobs, 04sell also.
REFER:
https://wordpress.stackexchange.com/questions/124770/how-to-order-the-get-categories-result
https://wordpress.stackexchange.com/questions/222285/custom-category-order-with-get-categoriesRegards!
July 7, 2018 at 7:14 pm #15688Thank you for your answer. You gave me hints where to look for answers to my problems (some keywords).
If someone else will have similiar problem to mine:
There is typo in your suggestion – there should be “slug” in “orderby” to sort categories by slug, not by name.`$get_categories = get_categories(array(
‘parent’ => $category,
‘orderby’ => ‘slug’,
‘order’ => ‘ASC’
));And also it looks like this is not the preatiest way to solve my problem, because slugs name are visible in address bar, so this is not perfect to place numbers in them.
After my research – you can sort filters alphabeticaly by description ( ‘orderby’ => ‘description’, ) and this is finest solutions that I have found.Anyway – without your efforts I would not even know the possibilities, so many thanks for your time. You can mark this problem as solved.
July 8, 2018 at 12:49 pm #15696Thanks for sharing, you are best!!
-
AuthorPosts
- You must be logged in to reply to this topic.
