Notifications
Clear all

[Solved] filter to add sortby topic title on boards home page

4 Posts
2 Users
0 Reactions
253 Views
Posts: 2
Topic starter
(@hgdev113)
New Member
Joined: 8 months ago

Code below works perfectly for topics individual list page but does not works for boards home page where multiple forums list .. i turned enabled this options -> Turn WordPress to this forum board

add_filter(‘wpforo_topic_list_args’, function ($args){
if(!empty($args)){
$forumIDs = array(1,2,8, 9);
if( in_array( $args[‘forumid’], $forumIDs) ){
$args[‘orderby’] = ‘type DESC,title ASC’;
$args[‘order’] = ”;
}
}
return $args;
});

 

any solution ? if yes please suggest

3 Replies
Robert
Posts: 10591
Admin
(@robert)
Support Team
Joined: 9 years ago

Hi @hgdev113,

Please let us know where this script coms from? I need to see the script description.

Posts: 2
Topic starter
(@hgdev113)
New Member
Joined: 8 months ago

here is the script i copied from https://wpforo.com/community/how-to-and-troubleshooting-2/can-i-sort-topics-by-title-or-column-header/paged/2/   to sort the topics by title

It works perfectly on individual forum page like https://myforum.com/boards/forum1   but not works  here https://myforum.com/boards/

1 Reply
Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10591

@hgdev113 

The URLs to your website don't work. In any case this cannot work on the home page because the home page is not a forum page. The home page is for forum list not for topic list. It displays topics from multiple forums so it cannot be sorted by individual forum id.