wordpress - How to display content from a child page within a hierarchial custom post type? -


i have hierarchical custom post type. has 6 pages, , each page has 3 child pages.

when viewing 1 of 6 pages, need display content (a title , excerpt) each of 3 child/descendent pages.

here current loop:

<?php if(have_posts()):?>     <?php query_posts('&post_type=how-we-do-it&post_parent=0');?>     <?php while(have_posts()):the_post();?>     <?php $color = get_post_meta( get_the_id(), 'pointb_how-we-do-it-color', true ); ?>       <div class="section">           <div class="title">             <h1 style="background:<?php echo $color;?> !important;">               <?php the_title();?>             </h1>           </div>           <div class="content">             <div class="how-<?php the_slug();?>">the summary here. , here child content:                 <div class="child">child content should here.</div>             </div>           </div>       </div>     <?php endwhile;?>     <?php wp_reset_query(); ?>     <?php endif;?> 

i have tried numerous different approaches try , accomplish need, none of them work within custom post type. here of various methods have tried:

i tried suggested code on page: http://wordpress.org/support/topic/display-child-pages-title-amp-content-on-parent-page

i tried following code:

$pagechildren = get_pages('child_of='.$post->id'); if ( $pagechildren ) {   foreach ( $pagechildren $pagechild ) {     echo '<h2><a href="' . get_permalink($pagechild->id) . '">'. $pagechild->post_title.'</a></h2> ';     if ($pagechild->post_excerpt){       echo ''.$pagechild->post_excerpt.'  ';     }   } } 

i've tried number of other methods didn't bother saving, can't show them.

i'm @ point getting frustrated , thought i'd throw out here fresh perspectives.

the issue first sample call if(have_posts()) before reconstruct query.

the second sample has dangling ' after $post->id.

try this:

$pagechildren = get_posts( 'post_type=how-we-do-it&post_parent='.$post->id ); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -