Limited Support
Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.
I have about 20 apps on my site, and was going to set up a forum for each one. That would be a bit of an admin nightmare! So the next theory is to create one forum, but have a list of "product tags", (ie if someone wanted to post about the product directory, they could enter "product_directory" as a tag. I'm assuming the search option can search tags. As I type this, I suddenly thought a "tag cloud" type widget might be easier)
This means I need to add a "sticky" to one forum within one board so I can list all the possible key tags to use. This post should remain in situ even when extra posts create pagination. (In that way, a USER can also type in that tag and find posts related to that app, rather than searching for posts containing that keyword in their title)
I came across this code, but the post was seven years old and things might have moved on since then:
function custom_order_sticky_topics( $topics ) { $rules = array(); //$rules[ ForumID ] = array( First TopicID, Second TopicID ); $rules[4] = array(19, 6); $rules[7] = array(26, 63, 68); if( function_exists('WPF') && isset(WPF()->current_object['template']) ){ if( WPF()->current_object['template'] == 'forum' || WPF()->current_object['template'] == 'topic' ){ $tmp = array(); $ordered = array(); if( empty($topics) || !isset($topics[0]['forumid']) || isset($topics[0]['permissions']) ){ return $topics; } else { $forumid = $topics[0]['forumid']; } if( !empty( $rules ) && isset( $rules[$forumid] ) ){ foreach( $topics as $key => $topic ){ if( isset($topic['topicid'])) { $tmp[$topic['topicid']] = $topic; } } if( !empty($tmp) ){ foreach( $rules[$forumid] as $topicid ){ if( isset($tmp[$topicid]) ) { $ordered[] = $tmp[$topicid]; unset($tmp[$topicid]); } } } $topics = array_merge($ordered, $tmp); $topics = array_values($topics); } } } return $topics; } add_filter( 'wpforo_get_topics', 'custom_order_sticky_topics', 20);
The reply suggested posting it within the function.php. However, on another plugin (sets default image on post), the vendor suggested that user's could also use similar "add_filter" code to a php code file, and place that file within the plugin folder, (effectively making it "private", and not affected by product updates) ** I know little about WP, but that would seem to suggest ALL plugins get loaded at runtime whether needed or not - which is probably why they advise keeping plugins to a min. In my own scripting, I use a "require" as and when a particular bit of extra code is needed.
In a nutshell, is the above code still the best method for sticky posts?