WordPress.org

Ready to get started?Download WordPress

Forums

Showing a page and its children (1 post)

  1. Morgan Kay
    Member
    Posted 2 years ago #

    Okay, hopefully this will be easier than the other questions I've been asking lately...

    I have a custom post type which is hierarchical, and I want to create a query that shows the current post AND all of its children. The following code does what I want, but it only shows the post's children:

    <?php query_posts(array('showposts' => 5, 'post_parent' => 128, 'post_type' => 'portfolio'));
    
    while (have_posts()) { the_post(); ?>
             <h3 class="entry-title"><?php the_title(); ?></h3>
    <?php }
    
    wp_reset_query();  // Restore global post data ?>

    How can I modify this so that the parent post is included in the loop along with the children?

Topic Closed

This topic has been closed to new replies.

About this Topic