Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to associate single topics to their parent forum for correct menu highlight?


  • Rosa Parker
    Participant

    @rosa-bosma

    This is my website: http://ecoperate.com, WordPress version is 4.0.1 and bbPress version is 2.5.4.

    I have two forum groups running on my website (‘Opportunities’ and ‘Forum’); both of them highlight a different item in the menu when they’re active. Now, what I can’t manage to do is highlighting the respective menu items in the forum topics. At least not in a way they can tell the parent forums apart.

    This works perfectly:

    .single-topic .genesis-nav-menu .menu-item-71 > a

    With the exception that only ONE of the menu-items is highlighted for every single topic (71 refers to menu item ‘Opportunities’). What I want to achieve is differentiation, by somehow linking the single-topics to the right parent forum. How can I do this?

    Any help would be greatly appreciated! 🙂

    Thanks,

    Rosa

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

  • Rosa Parker
    Participant

    @rosa-bosma

    Meant to write ‘associate with’ in the title. Forum won’t let me change it…


    Stagger Lee
    Participant

    @stagger-lee

    You explained a bit confuse. You want parent-child menu highlightning ?
    I am afraid it is not possible that way. Your menu link is simple page with shortcode (page-id-502).


    Stagger Lee
    Participant

    @stagger-lee

    Try to adapt this:

    add_filter( 'nav_menu_css_class', 'namespace_menu_classes', 10, 2 );
    function namespace_menu_classes( $classes , $item ){
        if ( in_array(get_post_type(), array('forum','topic','reply')) )
    	 {
            $classes = str_replace( 'current_page_parent', '', $classes );
            $classes = str_replace( 'menu-item-22902', 'current-page-parent', $classes );
        }
        return $classes;
    }

    Rosa Parker
    Participant

    @rosa-bosma

    Where exactly should I put that code? I put it in functions.php with no result, so I guess I was wrong…

    Thanks for your reply, anyway.


    Stagger Lee
    Participant

    @stagger-lee

    It wont do, you need CSS styling.


    Stagger Lee
    Participant

    @stagger-lee

    Change 22902 to 504.

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