include multiple Pages?
-
I’m full of questions today.
Okay, I have a navigational list that is to go in the sidebar (using WordPress as a CMS, and all pages are Pages, save the index – that one will contain posts). This is a very complex sidebar, so I can’t reall yuse the wp_list_pages() thing, as it messes up my classes and ID’s. So I had to go for the straight hard-coding.
I still need some dynamic activity though – namely for the hover state of the link to remain when it’s aon the current Page. I have that working, no problem. My problem is that when I’m on a sub-Page (child of a Page), the sub_page link is highlighted as “current”, but the parent is not. I would like for *both* the parent *and* the child to be highlighted – but I can’t seem to find the proper code for that. I can *exclude* all I’d like – but it seems it would be easier if there were an “include” instead.
This is my example so far:
<ul id="nav">
<li id="about" <?php if (is_page('2')) { echo "class=\"current\"";} ?>><a href="">
<img src="<?php bloginfo('template_directory'); ?>/images/about_us_off.gif" width="128" height="16" alt="About Us" /></a></li>
<ul id="subnav">
<li id="about_lynne" <?php if (is_page('15')) { echo "class=\"current\"";} ?>><a href="">
<img src="<?php bloginfo('template_directory'); ?>/images/about_lynne_off.gif" width="120" height="13" alt="About Lynne" /></a></li>
<li id="about_book" <?php if (is_page('16')) { echo "class=\"current\"";} ?>><a href="">
<img src="<?php bloginfo('template_directory'); ?>/images/about_book_off.gif" width="120" height="13" alt="About the Book" /></a></li>
<li id="mission_values" <?php if (is_page('17')) { echo "class=\"current\"";} ?>><a href="">
<img src="<?php bloginfo('template_directory'); ?>/images/mission_values_off.gif" width="120" height="13" alt="Mission & Values" /></a></li>
</ul>So, basically, if you’re on Page 15 (which is “About Lynne”, I would like “About Lynne” to be highlighted (as it is now), but I’d also like “About Us” to be highlighted as well (Page 2). I’ve tried:
<li id="about" <?php if (is_page('2,15,16,17')) { echo "class=\"current\"";} ?>><a href="">
<img src="<?php bloginfo('template_directory'); ?>/images/about_us_off.gif" width="128" height="16" alt="About Us" /></a></li>And it doesn’t work *at all*. Would anyone know the correct formatting of that so I could get what I want? I’d appreciate it 🙂
The topic ‘include multiple Pages?’ is closed to new replies.