WordPress.org

Ready to get started?Download WordPress

Forums

How to set the active tab in nav for a page (8 posts)

  1. ximyu
    Member
    Posted 3 years ago #

    Hi Guys,

    I've a wordpress site with 5 tabs in nav, corresponding to 5 pages. Now for some other pages, I would also like certain tab to be displayed as active for the page. How can I achieve this?

    For example, now going to home.php will have the "Home" tab active. But I also have another, say, newhome.php, in which I would also like the "Home" tab to appear as active. How to do that?

  2. Emil Uzelac
    Theme Review Admin
    Posted 3 years ago #

    It always helps to provide us with your site, however here's the example how you can do this:

    Assuming that your main menu is styled with .menu from your stylesheet.

    .menu .current_page_item a {
        color: #777;
    }

    This CSS style will change the color of your current/active page to #777 (grey) . You can add background as well.

  3. ximyu
    Member
    Posted 3 years ago #

    Here is my site:
    http://insidegig.com/blog/
    In this page, the tab is highlighted as expected.
    But in this one:
    http://insidegig.com/uncategorized/make-your-office-work-for-you/

    No tab is highlighted. I'm wondering how to designate which tab to highlight for the second page?

  4. Emil Uzelac
    Theme Review Admin
    Posted 3 years ago #

    Not sure what needs to be highlighted here? Make your office work for you is a post from "uncategorized" category.

    You are here: Home / For Employers / Make Your Office Work for You

    The last part tells you where you are via breadcrumb.

  5. ximyu
    Member
    Posted 3 years ago #

    Is there anyway to get the "Training" tab as current for the second page?

  6. Emil Uzelac
    Theme Review Admin
    Posted 3 years ago #

    Yes, so if all posts are under the same category and/or you want "Training
    " to remain current, try this in your header.php or where your main menu is located.

    <li class="<?php if ( is_home() || is_category() ) { echo "current_page_item"; } ?>"><a href="<?php echo get_option ('home'); ?>">Training</a></li>
  7. ximyu
    Member
    Posted 3 years ago #

    Thanks a lot. I'll try that.

  8. Emil Uzelac
    Theme Review Admin
    Posted 3 years ago #

    No problem :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.