Adding a Nav menu to all child pages
-
Hello Forum,
I am trying to add a navigation menu to all of the child pages in my Image Gallery section. I can get the menu to appear on the parent page using a conditional statement placed in the page.php file. I’m trying to call all the child pages (and, in fact, NOT the parent page) using the info in this post http://wordpress.org/support/topic/conditional-tags-and-parentchild-pages.
I can’t get the menu to appear on the child pages, though.
Thanks so much for any help!!
Here is the site link: http://fullcirclephoto.com/gallery/
And, here is my code:<?php get_header() ?>
<div id=”container”>
<div id=”content”><?php the_post() ?>
<div id=”post-<?php the_ID() ?>” class=”<?php sandbox_post_class() ?>”>
<h2 class=”entry-title”><?php the_title() ?></h2><?php
$page = $wp_query->post;
$parent_name = $wpdb->get_var(“SELECT post_name FROM $wpdb->posts WHERE ID = ‘$page->post_parent;'”);
?>
<?php if (is_page(‘Image Gallery’)|| ‘Image Gallery’ == $parent_name ) { ?><!– * { margin:0; padding:0; html { background:#444; }
table { margin:50px auto; width:630px; height:466px; background:#222; overflow:hidden; }
div#menu { top:40px; left:0px; width:100%; background:transparent url(images/header_bg.gif) repeat-x 0 0; } div#copyright { display: none; } –>
<div id=”Gmenu”>
<ul class=”Gmenu”><li class=”GmenuLi”><span>North America</span>
<div>
- <span>Arizona</span>
- <span>California</span>
- <span>Florida</span>
- <span>Kentucky</span>
- <span>Maine</span>
- <span>Maryland</span>
<div>
- <span>Baltimore</span>
- <span>Eastern Shore</span>
- <span>Central Maryland</span>
- <span>Western Maryland</span>
- <span>Northern Maryland</span>
</div>
</div>
- <span>Mexico</span>
- <span>Canada</span>
</div>
<li class=”GmenuLi”><span>South America</span>
<div>
- <span>Argentina</span>
- <span>Bolivia</span>
- <span>Chile</span>
- <span>Ecuador</span>
- <span>Peru</span>
</div>
<li class=”GmenuLi”><span>Africa</span>
<div>
</div>
<li class=”GmenuLi”><span>Europe</span>
<div>
- <span>France</span>
- <span>Germany</span>
- <span>Italy</span>
- <span>Spain</span>
- <span>Switzerland</span>
</div>
<li class=”last”><span>Asia</span>
<div>- <span>China</span>
<div>
</div>
</div>
</div><?php } else { ?>
<div style=”background:#ffffff” </div>
<?php } ?>
<div class=”entry-content”>
<?php the_content() ?>
<?php wp_link_pages(‘before=<div class=”page-link”>’ . __( ‘Pages:’, ‘sandbox’ ) . ‘&after=</div>’) ?>
<?php edit_post_link( __( ‘Edit’, ‘sandbox’ ), ‘<span class=”edit-link”>’, ‘</span>’ ) ?>
</div>
</div><!– .post –>
</div><!– #content –>
</div><!– #container –><?php // get_sidebar() ?>
<?php get_footer() ?>
- The topic ‘Adding a Nav menu to all child pages’ is closed to new replies.