Can anyone tell me why this IS working?
-
Yah, I know, odd, huh? I’m not much of a PHP geek, I do nothing but copy and paste. I’ve got something here that peaked my curiosity.
So, OK, here goes…I just found this and put it in my header.php for the navigation:
<ul class="navigation"> <li class="first <?php if ( is_home() ) { ?>current_page_item<?php } ?>"></li> <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?> </ul>
I added in that 2nd PHP string, which makes the current page’s link color change, by giving it the “.current_page_item” class, so it can be styled it in the CSS.
BUT…, I am using a custom template for my landing (Home) page which I’ve set to call a DIFFERENT header (homeheader.php) which only has THIS for the navigation:
<ul class="navigation"><?php wp_list_pages('depth=1&title_li='); ?></ul></div>
Nothing about “.current_page_item” in there.So why does it work across the whole site, by giving the current page in the nav the “.current_page_item” class?
- The topic ‘Can anyone tell me why this IS working?’ is closed to new replies.