• Resolved kmaier

    (@kmaier)


    I have been trying to figure a solution for quite sometime without having to make more template pages regarding displaying sub pages when you are within a parent section. I also would like those children to stay up if you are viewing one of its siblings. I’ve tried a few things I found in the forums but have not had any luck, does anyone have any examples?

    you can see what i am trying to attempt here.
    DDp

    here is the code i am working with. i have tried to exclude the parents for the other pages but it doesn’t seem to work…I’m missing something.

    <div id="mainNav">
    
    				<div id="demo"><a href="/demo-reel/"><span>DEMO REEL</span></a></div>
    				<div id="commercial"><a href="/commercial/"><span>COMMERCIAL</span></a></div>
              		 <ul><?php
    					if (is_page( )) {
    
      					$page = $post->ID;
    
      					if ($post->post_parent) {
        					$page = $post->post_parent;
      					}
    
      					$children=wp_list_pages( 'echo=0&depth=&child_of=' . $page . '&title_li=' );
    
      					if ($children) {
        					$output = wp_list_pages ('echo=0&depth=&child_of=' . $page . '&title_li=');
      					}
    
    					}
    
    					echo $output; ?>
                       </ul>
    				<div id="docubites"><a href="/docubites/"><span>DOCUBITES</span></a></div>
              		 <ul><?php
    					if (is_page( )) {
    
      					$page = $post->ID;
    
      					if ($post->post_parent) {
        					$page = $post->post_parent;
      					}
    
      					$children=wp_list_pages( 'echo=0&depth=&child_of=' . $page . '&title_li=' );
    
      					if ($children) {
        					$output = wp_list_pages ('echo=0&depth=&child_of=' . $page . '&title_li=');
      					}
    
    					}
    
    					echo $output; ?>
                       </ul>
    				<div id="candy"><a href="/candy/"><span>CANDY</span></a></div>
              		 <ul><?php
    					if (is_page( )) {
    
      					$page = $post->ID;
    
      					if ($post->post_parent) {
        					$page = $post->post_parent;
      					}
    
      					$children=wp_list_pages( 'echo=0&depth=&child_of=' . $page . '&title_li=' );
    
      					if ($children) {
        					$output = wp_list_pages ('echo=0&depth=&child_of=' . $page . '&title_li=');
      					}
    
    					}
    
    					echo $output; ?>
                       </ul>
    				<div id="about"><a href="/about-us/"><span>ABOUT US</span></a></div>
    				<div id="contact"><a href="/contact/"><span>CONTACT</span></a></div>
    
    			</div>

    Thanks for any guidance.

    kmaier

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kmaier

    (@kmaier)

    PLEASE HELP!!??

    Thread Starter kmaier

    (@kmaier)

    found a solution. not sure if its the best but it works for me!

    For anyone out there looking this might help you as well. I just added an if statement looking for the page id and or the parent id.

    <div id="mainNav">
    
    				<div id="demo"><a href="/demo-reel/"><span>DEMO REEL</span></a></div>
    				<div id="commercial"><a href="/commercial/"><span>COMMERCIAL</span></a></div>
              		 <ul><?php
    				 if ( is_page('50') || $post->post_parent == '50' ){
    
    						$page = $post->ID;
    
      					if ($post->post_parent) {
        					$page = $post->post_parent;
      					}
    
      					$children=wp_list_pages( 'echo=0&depth=&child_of=' . $page . '&title_li=' );
    
      					if ($children) {
        					$output = wp_list_pages ('echo=0&depth=&child_of=' . $page . '&title_li=');
      					}
    
    					echo $output;
    
    							}
    							else {
    
    							}
    				 ?>
                       </ul>
    				<div id="docubites"><a href="/docubites/"><span>DOCUBITES</span></a></div>
              		<ul><?php
    				 if ( is_page('55') || $post->post_parent == '55'  ){
    
    						$page = $post->ID;
    
      					if ($post->post_parent) {
        					$page = $post->post_parent;
      					}
    
      					$children=wp_list_pages( 'echo=0&depth=&child_of=' . $page . '&title_li=' );
    
      					if ($children) {
        					$output = wp_list_pages ('echo=0&depth=&child_of=' . $page . '&title_li=');
      					}
    
    					echo $output;
    
    							}
    							else {
    
    							}
    				 ?>
                       </ul>
    
    				<div id="candy"><a href="/candy/"><span>CANDY</span></a></div>
              		<ul><?php
    				 if ( is_page('59') || $post->post_parent == '59' ){
    
    						$page = $post->ID;
    
      					if ($post->post_parent) {
        					$page = $post->post_parent;
      					}
    
      					$children=wp_list_pages( 'echo=0&depth=&child_of=' . $page . '&title_li=' );
    
      					if ($children) {
        					$output = wp_list_pages ('echo=0&depth=&child_of=' . $page . '&title_li=');
      					}
    
    					echo $output;
    
    							}
    							else {
    
    							}
    				 ?>
                       </ul>
    				<div id="about"><a href="/about-us/"><span>ABOUT US</span></a></div>
    				<div id="contact"><a href="/contact/"><span>CONTACT</span></a></div>
    
    			</div>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘parent and child page woes’ is closed to new replies.