Support » Fixing WordPress » query_posts and post_parent -> not working

  • bellemode

    (@bellemode)


    On my home page of the site I’m working on (which uses home.php) I want to display content from different pages from parent with id of 96 and 101, and the title of the pages.

    With this in mind I used

    <div id="about">
    		<?php query_posts('posts_per_page=1&post_type=page&post_parent=96'); the_post(); ?>
    		<h1><?php the_title(); ?></h1>
    		<?php the_content(); ?>
    		</div>

    It seemed to work at first and I was excited. Then I placed another query on the page

    <div class="information">
    <?php query_posts('posts_per_page=1&post_type=page&post_parent=101'); the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <div class="underline"><img src="<?php echo bloginfo('template_url'); ?>/images/underline.png" width="90" height="8" alt="underline"></div>
    <?php the_content(); ?>
    </div>

    Then both areas were displaying the parent 101 data. Then I refreshed and it won’t display any data in those divs.

    I tried isolating it by taking out &post_parent=96 When I do that it goes back to posting the most recent page created. I don’t understand why it won’t pull in the id I’m asking for.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘query_posts and post_parent -> not working’ is closed to new replies.