Submenu sorting issue

Posted in: Newsmag
Post count: 52

Hello,

I have a problem with the default sorting of the sub-menu items.

If you check here: http://firm-guide.com/category/cars/ automotive brands are sorted alphabetically but I want to sort them based on number of posts – ascending so that only the most relevant brands appear.

Where can I modify this?

Thanks as always
Marek

Post count: 7909

Hi,

Here you can add your order code like this: http://screencast.com/t/BcO7p2lrigIe
I have added to order by ID to show you that it works – http://screencast.com/t/97cJZaUIYK but you can modify this but I’m not sure what sort order will help you to achieve that: https://codex.wordpress.org/Function_Reference/get_categorieshttp://screencast.com/t/AaewAn6lkZF
You can try to sort by slug and change slug name for categories that you want to appear there: http://screencast.com/t/Cb2tRIWEhttp://screencast.com/t/r6DgwJhxH

Thanks!

Post count: 52

Hello,

perfectly working for the top category.

I have this code:

// get child categories
$categories_objects = get_categories( array(
'parent' => $this->current_category_obj->cat_ID,
'hide_empty' => 0,
'number' => self::SIBLING_CATEGORY_LIMIT,
'orderby' => 'count',
'order' => 'DESC'

and the companies are nicely sorted here:
http://firm-guide.com/category/cars/

BUT when I visit the subcategory, it is still sorted alphabetically (for example here: http://firm-guide.com/category/cars/ford/) so I believe I need to change the code also somewhere else – please advise

Post count: 7909

Hi,

Try to add your code also bellow that: http://screencast.com/t/6BrH3ndrMhttp://screencast.com/t/JDvnGRnW

Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newsmag’ is closed to new topics and replies.