Skip to:

hide subforums on main page

  • I have tried a variety of codes that have been offered up in these forums in an attempt to hide subforums on my main page because one of my parent forums is dog breeds~~~ can you imagine how HUGE my front page will beonce I add in all of my subforums?

    All of my attempts to utilize code offered in the forums has failed. One piece looked likeit MIGHT do what I wanted, but I could never figure out where to paste it!

    Please forgive me for my lack of knowledge ~~~ I am learning as I go.

    I have pasted my code for my front-page.php into the paste bin. If you could look at it and give me a clue, I’d appreciate it!!!



Viewing 15 replies - 1 through 15 (of 15 total)

  • _ck_


    If you are asking what I think you are asking, I think I have made the subtle change you need. The sub-forums will no longer be shown on the front-page.

    Line 53 is really all that’s needed.

    if (!$forum->forum_parent) {

    This is untested however.

    Topics from within the sub-forums will still showup in the latest discussions however.

    That did exactly what I was wanting on the front page, but now you can’t find the subforums at all. I had thought that when I clicked the parent forum it would automatically show the subforums ~ either on the front page or on a new page. Instead, it just goes to an “Add a topic” page. Any ideas?

    Please forgive my bad spacing at times. When I’m in firefox, this doesn’t happen because of auto-spellcheck, but in IE, I miss fixing some of it. I messed up the spacebar on this keyboard and it doesn’t alway space like it should =(

    Thanks _ck_!


    OH ~ and I had actually tried a copy & paste of the code that you changed through finding it in another thread, but there was some kind of error in his syntax, cause it just gave me error messages.



    When you go into a forum, it should show you all the sub-forums available. If there are no topics in that forum however, it may just immediately jump to add new topic – that may be a bug in how bbPress works. Try creating a test topic in the main forum that has sub-forums.

    If your forum has topics and still does not show sub-forums, you edited your theme somewhere and removed it or you are using a theme that removed the feature. If so, put into pastebin your forum.php page from your theme and show it to me.

    I don’t know whether I did it or if it was in the template I modified, but posting a topic in the main Dog Breed Forum didn’t correct the issue. I posted my forum.php code in the pastebin:

    Thanks,_ck_ ~ I only hope that I understand php and bbpress forums as well as you do one day!




    Somehow you removed the sub-forum code from your theme.

    Here’s a guess at the correctly inserted code:

    I’m not surprised . . . I know so little about php that trying to use code snippets and paste them into my pages, the deleting them if it didn’t work is creating havoc for me. The code you left in the paste bin fixed my problem! =)

    This is whyI made the offer I did last night ~~~ I feel bad always having to have you do more than you would have to for someone who is well-versed in the language and design of the forums ~~~ and there are a lot of issues that I don’t know how to resolve. If I post them all, I’m going to bust the boards! LOL

    Thanks for the code, _ck_!!!! Now my subforums are showing when I click the main forum from my front page =)


    by the way, an even better way to implement this is to use the args of bb_forums() properly… namely if you change your theme to call bb_forums(“depth=1”) you will only get 1 level of forums on the page.

    This change can be made to the front-page or forum of your theme. If your theme calls bb_forums($forum_id) then it is asking for the child forums of the existing forum and you need to change the code to something like this… bb_forums(“depth=1&child_of=$forum_id”)

    Thanks, Zappoman, your way worked perfectly.

    Guys – all your ‘pastebin’ code has disappeared from that site. Eight months has elapsed since the post before this one. Any chance it can be added back again please? Or is there documentation somewhere else. Thanks for the trouble.

    This topic has been marked [resolved] when it isn;t for me (with the greatest of respect for the forum administrator) so has continued the discussion on another thred about the same topic. Thanks.

    OK – now I gotcha:

    If using the default (kakumei) theme, lo0k for this code which is about line 43:

    <?php if ( bb_forums() ) : ?>

    REPLACE it with this code:

    <?php if ( bb_forums(“depth=1”) ) : ?>

    Works beatifuuly as described.

    I have a problem, i don’t know what to do. I am using the crystal theme, which instead of having:

    <?php if ( bb_forums() ) : ?>

    it has

    <?php if ($forums) : ?>

    and substituting those replacements isn’t working. Any ideas?



    @pikatore, please start a new topic. This one is resolved and over a year old.

    sorry. im an idiot.

    i basically did a front page code transplant, so for all intents and purposes, my theme is kakumei now.

    But neither of the above suggestions work. Instead all my subforums just get sent to the bottom of the list.

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.
Skip to toolbar