Support » Fixing WordPress » Displaying Child Pages of Parent but Children are not recognizing Parent

  • Jorge

    (@jledesmaddsgmailcom)


    Hello folks,

    This is as bizarre as I can go. Over at this page http://meyer-waxy.jorgeledesma.net/journal/ which is a template I used 3 types of code to just echo the child pages of this parent and I have no idea why its only showing one of those childs. Notice here a screenshot of my admin page panel screenshot how you can see more children of the Journal page which is id 445.

    The codes I’ve tried are as follow:

    <ul>
      <?php
      global $id;
      wp_list_pages("title_li=&child_of=$id&show_date=modified
      &date_format=$date_format"); ?>
    </ul>

    This one works and just echoes only 1 child

    <?php
    	$mypages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');
    
    	foreach($mypages as $page)
    	{
    		$content = $page->post_content;
    		if(!$content) // Check for empty page
    			continue;
    
    		$content = apply_filters('the_content', $content);
    	?>
    		<h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2>
    		<div class="entry"><?php echo $content ?></div>
    	<?php
    	}
    ?>

    more here

    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
      if ($children) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } ?>

    and here

    <?php if($post->post_parent) $children =wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->post_parent."&echo=0"); else
    $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->ID."&echo=0");
    if ($children) { ?>
    <ul>
    <?php echo $children; ?>
    </ul>
    <?php } ?>

    To be honest, I’m lost as a cat. For some odd reason, it seems like the other children are not recognizing the parent and not echoing but for another reason its only echoing 1 child. Anyway on my sidebar I have a similar code to display the children as well but limiting them with the ‘include= id, id, id’ to limit this section to only 3 items but again, only the 1 child is echoing and I triple checked the id to make sure they were those, Bizarre.

    Anyway, any hints as to how to resolve would be extremely appreciated.

    regards,
    Jorge

Viewing 1 replies (of 1 total)
  • Jorge

    (@jledesmaddsgmailcom)

    I switched the mod to display category in a page template, this was driving me nuts, if you see something on this code, do tell please, thanks, otherwise c’est fini, moving on, thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Displaying Child Pages of Parent but Children are not recognizing Parent’ is closed to new replies.