Support » Theme: Responsive » Highlight Parent Menu Item while in Child Page

  • Hi all,

    I have the free reponsive wordpress theme and I have come across something I cannot resolve via CSS. What I want to do is have the parent menu item retain its active color while the user views a child page. To be more specific here is an example.

    We have a page say called Company. This page has a menu item in the main nav menu. There is a number of pages setup as children to this page in wordpress backend but DO NOT have any menu items. What I want is that when somebody is viewing any of these pages the menu item of the Company page to remain with active color.

    I have tried all CSS ways I have found around but nothing works. I have listed all CSS tried below.

    .menu .current_page_item a,
    .menu .current-menu-item a,
    .menu .current_page_parent a,
    .menu .current_page_ancestor a,
    .menu .current-menu-parent a,
    .menu .current-menu-ancestor a {
    	background-color: #343434;

    Any suggestions anyone?

    Thanks a lot.


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


    Forum Moderator

    As per the theme developer’s request, please post in the theme’s dedicated forum:


    OK thanks for the info. Doing this now.


    I just insert the following code in the theme’s footer.php file right before the closing body tag </body>.

    <!-- Highlight parent page link when on child page -->
    <?php if (is_page()) {   //  displaying a child page ?>
        <script type="text/javascript">
    <?php } ?>

    Simply put, the code adds another native WordPress nav li class that makes the link of the current page active.

    For a detailed explanation of how this works I wrote a short post here; [link moderated]

    Hope that helps!

    @bibianowency – please note that posting links to your site is not the purpose of these forums –

    If you want to help out here, that’s great, but when you post in old, already resolved threads doing that, that’s not so good.

    Further any such changes should always be made in a child theme.

    @wpyogi – I’m sorry about what I did mate. I’m heeding your advice and will avoid doing the same thing again.


    @bibianowency – Thanks for the tip. It will certainly be used.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Highlight Parent Menu Item while in Child Page’ is closed to new replies.