Need help? Check out our Support site, then


Hightlighting current link in menus - with categories and pages

  1. Hello!

    I'm trying to get this menu to work on my custom theme:

    http://www.totallyrich.com

    The menu links are hardcoded into the header.php template. As you can see I use 'Home' one page and four categories. Here's the code I have tried to use:

    </p> <ul> <?php if(is_home() && !is_paged()){ ?><br /> <!-- li><br /> <a>" title="You are Home">Blog Navigation</a><br /> </li --><br /> <?php } else { ?></p> <li> <a>" title="Click for Home">Home</a> </li> <p> <?php } ?></p> <li> <a <?php<br /> if (is_category('Photography') || in_category('27') && !is_single())<br /> {<br /> echo " class=\"current\"";<br /> }?> href="<?php bloginfo('url') ?>/category/photography">Photography </li> <li> <a <?php<br /> if (is_category('The Interweb') || in_category('25') && !is_single())<br /> {<br /> echo " class=\"current\"";<br /> }?> href="<?php bloginfo('url') ?>/category/the-interweb">The Interweb </li> <li> <a <?php<br /> if (is_category('Motorsport') || in_category('24') && !is_single())<br /> {<br /> echo " class=\"current\"";<br /> }?> href="<?php bloginfo('url') ?>/category/motorsport">Motorsport </li> <li> <a <?php<br /> if (is_category('Everything Else') || in_category('28') && !is_single())<br /> {<br /> echo " class=\"current\"";<br /> }?> href="<?php bloginfo('url') ?>/category/everything-else">Everything Else </li> <li> <a <?php<br /> if (is_page('Contact'))<br /> {<br /> echo " class=\"current\"";<br /> }?> href="<?php bloginfo('url') ?>/contact">Contact </li> </ul> <p>

    Issue 1:
    When on the homepage the 'Motorsport' link is highlighted.

    Issue 2:
    When on the contact page the 'Everything Else' link is highlighted.

    Issue 3:
    If you click though to a single post the menu loses it's highlighting.

    Has anyone tried something like this before? or do you have any ideas how I can make this work???

    Looking forward to hear your response...

    Cheers,
    Rich

  2. You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for WordPress.com hosted blogs only. If you have a self-hosted WordPress blog you need to seek help at the WordPress.org forums, not here.

    If you don't understand the difference, you may find this information helpful.

Topic Closed

This topic has been closed to new replies.

About this Topic