bbPress

Simple, Fast, Elegant

bbPress support forums » Plugins

plugin request: exclude all topics from specific sub-forums on front-page only

(3 posts)
  • Started 11 months ago by _ck_
  • Latest reply from HowToGeek
  • This topic is not resolved
  1. I'll probably end up trying to write this myself over the rest of the week but just in case a plugin guru is willing to help...

    I'd like to exclude certain sub-forum topics from the latest discussions that are posted on the front page. I know how to tap into the list topics filter but I don't know how to make it obey only for the front page, because obviously they can't be excluded from the sub-forum's own topic list when they are on that page.

    In theory I could hack the template to do this but it would be much better via a plugin if possible. I can see other people wanting this feature eventually to help keep that front page list from becoming cluttered.

    Posted 11 months ago #
  2. Ah nevermind - I already knew how to do this but was so tired I didn't put 2 + 2 together. And a new plugin was born!

    This plugin will either exclude ALL sub-forums from the front page topics list AND/OR exclude any specific forums from the front page that you specify.

    function filter_front_page_topics($where){
    // $exclude_forums=array ("8,1,3,12");   // enable this to manually specify specific forums by id #
    $forums = get_forums(); foreach ($forums as $forum) {if  ($forum->forum_parent) {$exclude_forums[]=$forum->forum_id;}}  // exclude ALL sub-forums
    if ( is_front() ) {foreach($exclude_forums as $forum) { $where.=" AND forum_id != ".$forum."  "; }}
    return  $where;
    }
    add_filter( 'get_latest_topics_where', 'filter_front_page_topics');
    add_filter( 'get_latest_posts_where', 'filter_front_page_topics');
    Posted 11 months ago #
  3. Thanks for this, as usual you are the best!

    Posted 2 months ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.