Skip to:
Content
Pages
Categories
Search
Top
Bottom

Navigation: topic or reply belongs to which forum?


  • Ray Gulick
    Participant

    @raygulick

    I have 2 separate forums in 2 separate sections of a website. Adding shortcode to a child page under each top-level parent page, current-page-ancestor allows hiliting of the correct top level nav item.

    However, as soon as a topic or reply is clicked, the ancestor/child relationship is lost, and the navigation item is un-hilited. Slugs for topics from one forum look identical to slugs from the other (except for topic name, of course).

    If I only had one forum, it would be fairly simple to make all topics and all replies hilite the same nav item, but with 2 forums in separate sections, I need to distinguish between topics and replies that belong with one forum or the other. Is there a conditional that allows me to determine which forum a topic or reply is associated with?

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

  • Ray Gulick
    Participant

    @raygulick

    Found the answer: bbp_get_forum_title()

    Incorporated that into an if statement in the nav wrapper, echoing a class name based on which forum ID.


    Ray Gulick
    Participant

    @raygulick

    Spoke too soon. Displays extra class at all times, hiliting the nav item when it should not be hilited. Wish I could show the code here, and someone could point out my errors.

    This topic should be in “troubleshooting”. Sorry, didn’t see different forums initially.


    Ray Gulick
    Participant

    @raygulick

    Example code (that does not work):

    `<nav class="usernav```">wp_nav_menu


    Ray Gulick
    Participant

    @raygulick

    Can’t figure out how to display code here. Can’t find a “how-to.”


    Ray Gulick
    Participant

    @raygulick

    Finally did resolve this:

    $ID = bbp_get_forum_id($forum_id);
    		if ($ID == 216) { 
    		echo ' staff'; 
    		} elseif ($ID == 236) { 
    		echo ' advisor'; 
    		}
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.