WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Menu Question (1 post)

  1. BritneyJackson
    Member
    Posted 6 years ago #

    Morning,

    I wondered if anyone was able to offer me some advice. I am trying to create a dynamic menu (see below) but I am running into a problem, the code below highlights 'News' if on single.php, archive & archive-2 pages.

    <li <?php if ( is_page("archive") || (is_page("archive-2") || (is_single()))) { echo 'class="current_page_item"';} ?>><a href="<?php bloginfo('url'); ?>/archive/">News</a></li>

    Now I want to create another menu item for 'gig' using the code below, but because the category post uses single.php it highlights the menu as 'news' because single.php is used in the 'news' menu item. Is there a way to trick WP into showing 'gigs' highlighted instead of 'news' when viewing a category post using single.php?

    <li <?php if ( is_category("9") || (is_page("gigs"))) { echo 'class="current_page_item"';} ?>><a href="<?php bloginfo('url'); ?>/gigs/">Gigs</a></li>

    Many thanks for any assistance you can offer :)

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 6 years ago by BritneyJackson
  • This topic is not resolved
  • WordPress version: 2.5.1

Tags