Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to add a child post into the parent page? Basically I have a 1 parent page and it has 2 child page that has a simple content , and I want the child page content to put also in the parent page ,BUT making it an as a excerpt, not output all content (just a teaser).

Havent clue yet how to pull that..

any help will do

share|improve this question
add comment

2 Answers

First, you need to query the child Pages:

$pageargs = array(
  'numberposts' => -1,
  'orderby' => 'menu_order',
  'order' => 'ASC',
  'post_type' => 'page',
  'post_parent' => $post->ID
);
$childpages = get_posts( $pageargs );

Then, you need to create your custom Loop:

foreach ( $childpages as $childpage ) {
    // Output whatever you want here, such as:
    ?>
    <h2><?php echo $childpage->post_title; ?></h2>
    <?php echo $childpage->post_exerpt; ?>
<?php }

Note, however, that Pages do not by default support excerpts. So, you'll need to enable that, in functions.php:

// Add Excerpt to Pages
add_post_type_support( 'page', 'excerpt' );

Then, you should be all set.

share|improve this answer
add comment

You can use get_page() in template of your parent page and retrieve child page. Then access data form it and format/output it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.