AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

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

4 Posts
2 Users
0 Reactions
895 Views
Posts: 2
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@hgdev113)
New Member
Joined: 2 years ago
[#56713]

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: 10749
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 3 months ago

Hi @hgdev113,

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


Posts: 2
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@hgdev113)
New Member
Joined: 2 years 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: 3 months ago

Support Team
Posts: 10749
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@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.


Share: