Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sidebar menu problem with bbpress


  • elitetester
    Participant

    @elitetester

    I have been building a site but have encountered a problem…

    I have created several forums. I use the shortcode to embed the required forum into the required page.
    For page1 I have included shortcode for forum1. To the left I have sidebarmenu1.
    For page2 I have included shortcode for forum2. To the left I have sidebarmenu2.
    For page3 I have included shortcode for forum3. To the left I have sidebarmenu3.
    etc

    The forums, pages and menus display fine UNTIL I post a topic. And I think the reason is because the url name is generic (/forums/topic…).
    The question is – How do I keep sidebarmenu3 visible when posting a topic within page3/forum3? (so sidebarmenu1 and 2 is hidden) etc?

    Or am I using bbpress in completely the wrong way?

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

  • elitetester
    Participant

    @elitetester

    Is it possible to give forum1 the url /forum1/ and then forum2 the url /forum2/ which is also used after posting new topic or replying to topic?

    Or perhaps separate installations of bbpress with different plugin names similar to above?


    elitetester
    Participant

    @elitetester

    Or maybe this can be solved with custom slugs or something?


    elitetester
    Participant

    @elitetester

    I wonder if this might be the solution for me. I will try to check this out later to see if it resolves the problem.

    Navigation: topic or reply belongs to which forum?


    koendb
    Participant

    @koendb

    Could try this:

    add to template: <?php bbp_forum_id(); ?>
    This way you’ll see the ID-number of a forum when you display it.
    Say, forum 1 has number xxx, 2 yyy, 3 zzz.
    Remove the line above from your template.

    Add this to the sidebar:
    <?php
    $forum = bbp_get_forum_id();
    if ($forum == xxx) {
    echo ‘code forum 1’;
    } else if ($forum == yyy) {
    echo ‘code forum 2’;
    } else if ($forum == zzz) {
    echo ‘code forum 3’;
    }
    ?>

    If you want to add a shortcode, you can do it this way in php.
    echo do_shortcode(‘[shortcode]’);

    Hope this will work 🙂


    elitetester
    Participant

    @elitetester

    Many thanks for this, this makes sense and looks like a logical solution.

    But, I’ve realised my issue is probably bigger than I thought. It’s not just a sidebar issue but more fundamental. When viewing or posting a new topic or reply the forum ‘jumps’ out of its parent page.

    e.g –
    (Viewing forum1 which is embedded in page1 using shortcode)
    When I post a new topic my url changes to:
    /’forum-root-slug’/’topic-slug’/
    and so I have ‘jumped-out’ of my original location. This is not what I want to happen. I want the user to stay within the current location. And so, sidebar1 should also stay there without any hacks/workarounds, and sidebar2 should also stay in place for page2 which contains forum2 etc.

    So going forward:
    ==> Any idea how to set a dynamic ‘forum-root-slug’ so that it is whatever the parent location is?

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