Highlighting Parent Pages When on a Child Page
-
Hi there,
Ive had a little hunt through the forums and have found alot of examples but none that i can get working with how ive made my site.
Bassically i want my Parent pages to be highlighted using id=current when on a child page.
My Parent pages are list items using background images and my child pages are text.
Below is my current code.
Any help would be greatly appreciated.
<div id="nava"> <ul id="menu"> <li <?php if (is_page('Home')) { echo "id=\"current\"";}?> class="home"><a href="/"><strong>Home</strong></a></li> <li <?php if (is_page('Never Green Pool Valets')) { echo "id=\"current\""; }?> class="neverGreen"><a href="/never-green-pool-valets"><strong>Never Green Pool Valets</strong></a></li> <li <?php if (is_page('Well Be There Repair Service')) { echo "id=\"current\""; }?> class="repairService"><a href="/well-be-there-repair-service"><strong>We'll Be There Repair Service</strong></a></li> <li <?php if (is_page('Specialist Products')) { echo "id=\"current\""; }?> class="specialistProducts"><a href="/specialist-products"><strong>Specialist Products</strong></a></li> <li <?php if (is_page('Contact and Bookings')) { echo "id=\"current\""; }?> class="contactBookings"><a href="/contact-and-bookings"><strong>Contact and Bookings</strong></a></li> </ul> </div> <div id="subnav"> <?php if($post->post_parent) $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?> </div>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Highlighting Parent Pages When on a Child Page’ is closed to new replies.