Advertisement
Guest User

WordPress query_posts Page Descendants

a guest
Apr 13th, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2.     query_posts( array(
  3.         'post_parent' => 58, // Only shows posts that are direct children of the Machinery page. I want all descendants.
  4.         //'child_of' => 58, // Appears to have no effect when used. Shows all descendants, not filtered by taxonomy or term.
  5.         'post_status' => 'any',
  6.         'post_type' => 'any',
  7.         'taxonomy' => 'industries',
  8.         'term' => 'dairy'
  9.     ));
  10. ?>
  11. <?php if ( have_posts() ) : ?>
  12.     <h4>Dairy Machinery</h4>
  13.     <ul>
  14.     <?php while (have_posts()) : the_post(); ?>    
  15.         <li>
  16.             <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  17.         </li>
  18.     <?php endwhile; ?>
  19.     </ul>
  20. <?php endif; wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement