• Resolved kenmontgroup

    (@kenmontgroup)


    Hello, from the sidebar menu I have 1st and 2nd level pages displaying the correct active state on the parent/ancestor (main) menu item when visited, however when navigating into a 3rd level page from the sidebar, the parent/ancestor (main) menu item does not show as active. Hoping there is some custom CSS that would help solve this. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor OnPoint Plugins

    (@onpointplugins)

    Hello Kenmontgroup,

    Most likely you are targeting the current_page_parent class with your CSS to create and active state. For targeting 2 levels or more above the current item, you may use the current_page_ancestor class.

    For example, if you have the highest level parent showing your CSS could look something like this:

    
    .advanced-sidebar-menu .parent-sidebar-menu > .current_page_parent,
    .advanced-sidebar-menu .parent-sidebar-menu > .current_page_ancestor {
    font-weight: 700;
    }
    

    Have a great weekend!

    Thread Starter kenmontgroup

    (@kenmontgroup)

    Hello, thanks so much for the quick reply and guidance!

    I tried that, but unfortunately did not work. I did inspect the main menu list item while visiting both 2nd and 3rd tier pages from the sidebar and noticed the following differences in the ‘li class’ for each:

    On any 2nd tier page (where the main menu item active state is styling properly), the ‘li class’ is:

    <li class=”menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor current-menu-ancestor current-menu-parent current-page-parent current_page_parent current_page_ancestor menu-item-has-children menu-item-824″>

    On any 3rd tier page (where there is no active state styling on the main menu item), the ‘li class’ is:

    <li class=”menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor menu-item-has-children menu-item-824″>

    So, on the 3rd tier pages, the li classes of “current-menu-ancestor current-menu-parent current-page-parent current_page_parent current_page_ancestor” are missing and therefore not making the primary nav menu item active when on those pages.

    Any further ideas? Thanks!

    Plugin Contributor OnPoint Plugins

    (@onpointplugins)

    Based on what you provided, it appears your site is using current-page-ancestor instead of current_page_ancestor.

    If which case, you’ll need to adjust the example CSS to account for the change.

    
    .advanced-sidebar-menu .parent-sidebar-menu > .current-page-parent a,
    .advanced-sidebar-menu .parent-sidebar-menu > .current-page-ancestor a {
    font-weight: 700;
    }
    

    Have a great weekend!

    Thread Starter kenmontgroup

    (@kenmontgroup)

    That worked – thank you so much for the additional guidance and quick follow-up! Have a great weekend!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Activate Parent in Main Nav for 3rd Level Sidebar Pages’ is closed to new replies.