template dependent navigation for static pages
-
Hi everyone,
The site I am working on consists almost exclusively of static pages in WP1.5.1 and is divided up into 6 main sections.
Each section consists of a parent page, its children and its grandchildren.
I would like to be able to vary the sidebar content to provide different secondary navigation for each section. In other words, whichever section you are in, the sidebar lists links to all the other children and grandchildren pages within that same section. With me so far?!
I have been searching the codex and the support forums and found equivalent solutions for if I was trying to do the same thing with posts and categories:
<?php
if ( is_category('3') ) {
include(TEMPLATEPATH . '/category3.php');
} elseif ( is_category('4') ) {
include(TEMPLATEPATH . '/support.php');
}etc
?>
But is there a way of calling different templates depending on what the parent/grandparent of a static page is?
Something along the lines of:
if ( is_descendantof('3') ) {
include(TEMPLATEPATH . '/section3.php');
}I would like my clients to be able to add pages and have them automatically included in the navigation so I don’t want to use wp_list_pages and manually set up exclusions every time a new page is written.
Thanks, hope this makes sense!
- The topic ‘template dependent navigation for static pages’ is closed to new replies.