Support » Themes and Templates » Get Pages by Parent

Get Pages by Parent

  • I’m trying to get pages where the parent of those pages is 157. I thought this would do the trick:

    <?php $my_loop = new WP_Query(‘post_parent=157’); ?>
    <?php while ($my_loop->have_posts()) : $my_loop->the_post(); ?>

    But it’s not working. ot sure where else to turn. Thoughts? Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Anyone have an idea why this isn’t working?

    I’m looking at some stuff along the same lines. How do you even relate a post to a parent?

    Hi there.. not sure if this is what you’re looking for.. but if so, here is what i use:

    `<?php if ($post->post_parent == ‘2’) {
    //code to run

    Good luck – cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get Pages by Parent’ is closed to new replies.
Skip to toolbar