Title: Conditional Navigation Highlighting Problems
Last modified: August 19, 2016

---

# Conditional Navigation Highlighting Problems

 *  [mattchandl3r](https://wordpress.org/support/users/mattchandl3r/)
 * (@mattchandl3r)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/conditional-navigation-highlighting-problems/)
 * Hi. I’m not too well-schooled in PHP “if” statements, and I’m brand new to administrating
   WordPress. I’m having a problem with my conditional navigation highlighting.
 * I’m calling my navigation menu from one file (header.php), and I’m trying to 
   achieve conditional highlighting. Here’s my code as it stands:
 *     ```
       <div id="nav">
       		<ul id="navbar">
       		<li <?php if (is_home()) {?>class="current_page_item"<?php } ?>><a href="<?php echo get_settings('home'); ?>/">Home</a></li>
               <li><a href="http://forum.communitycarefund.org" target="_blank">Forum</a></li>
       		<li <?php if (is_page(3)) {?>class="current_page_item"<?php } ?>><a href="<?php echo get_settings(3); ?>/">About</a></li>
       		<li <?php if (is_page(4)) {?>class="current_page_item"<?php } ?>><a href="<?php echo get_settings(4); ?>/">Events</a></li>
               <li <?php if (is_page(5)) {?>class="current_page_item"<?php } ?>><a href="<?php echo get_settings(5); ?>/">Donate</a></li>
               <li <?php if (is_page(6)) {?>class="current_page_item"<?php } ?>><a href="<?php echo get_settings(6); ?>/">Resources</a></li>
               <li <?php if (is_page(12)) {?>class="current_page_item"<?php } ?>><a href="<?php echo get_settings(12); ?>/">In Action</a></li>
       		</ul></div>
       ```
   
 * What ends up happening is the links all end up pointing to the index.php file
   rather than the page_id indicated in each link. I know there’s probably something
   small going wrong here, but I can’t figure out what it is.
 * Here’s the site in question so you can see what I’m talking about:
 * [http://www.communitycarefund.org/blog/](http://www.communitycarefund.org/blog/)
 * Any/all help is appreciated.

Viewing 1 replies (of 1 total)

 *  Thread Starter [mattchandl3r](https://wordpress.org/support/users/mattchandl3r/)
 * (@mattchandl3r)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/conditional-navigation-highlighting-problems/#post-714769)
 * Strike that. Figured it out. Just needed a smoke break, ya dig?
 * For the curious:
 *     ```
       <div id="nav">
       		<ul id="navbar">
       		<li <?php if (is_home()) {?>class="current_page_item"<?php } ?>><a href="<?php echo get_settings('home'); ?>/">Home</a></li>
               <li><a href="http://forum.communitycarefund.org" target="_blank">Forum</a></li>
              	<li <?php if (is_page('About')) {?>class="current_page_item"<?php } ?>><a href="?page_id=3">About</a></li>
               <li <?php if (is_page('Events')) {?>class="current_page_item"<?php } ?>><a href="?page_id=4">Events</a></li>
               <li <?php if (is_page('Donate')) {?>class="current_page_item"<?php } ?>><a href="?page_id=5">Donate</a></li>
               <li <?php if (is_page('Resources')) {?>class="current_page_item"<?php } ?>><a href="?page_id=6">Resources</a></li>
               <li <?php if (is_page('In Action')) {?>class="current_page_item"<?php } ?>><a href="?page_id=12">In Action</a></li>
       		</ul></div>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Conditional Navigation Highlighting Problems’ is closed to new replies.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [highlighting](https://wordpress.org/support/topic-tag/highlighting/)
 * [if](https://wordpress.org/support/topic-tag/if/)
 * [navigation](https://wordpress.org/support/topic-tag/navigation/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [mattchandl3r](https://wordpress.org/support/users/mattchandl3r/)
 * Last activity: [18 years, 2 months ago](https://wordpress.org/support/topic/conditional-navigation-highlighting-problems/#post-714769)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
