Advertisement
Guest User

My Nested Queries

a guest
Nov 5th, 2011
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2. $args = array(
  3. 'post_type' => 'clients-placements',
  4. 'posts_per_page' => -1,
  5. 'post_status' => 'publish',
  6. 'order' => 'ASC',
  7. 'meta_query' => array(
  8. array(
  9. 'key' => 'type',
  10. 'value' => 'Client'
  11. ),
  12. array(
  13. 'key' => 'featured',
  14. 'value' => 'yes'
  15.  
  16. )
  17. )
  18. );
  19. $the_query = new WP_Query( $args );
  20. ?>
  21.  
  22. <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  23.  
  24. <?php get_template_part( 'content', 'clients' );?>
  25.  
  26. <ul id="placements">
  27. <?php
  28. $args = array(
  29. 'post_type' => 'clients-placements',
  30. 'posts_per_page' => -1,
  31. 'post_status' => 'publish',
  32. 'order' => 'ASC',
  33. 'post_parent' => $post->ID,
  34. 'meta_query' => array(
  35. array(
  36. 'key' => 'type',
  37. 'value' => 'Placement',
  38. ),
  39. array(
  40. 'key' => 'featured',
  41. 'value' => 'yes',
  42.  
  43. )
  44. )
  45. );
  46. $the_query = new WP_Query( $args );
  47.  
  48. // The Loop
  49. while ( $the_query->have_posts() ) : $the_query->the_post();
  50. echo '<li>';
  51. the_title();
  52. the_content();
  53. echo '</li>';
  54. endwhile;
  55.  
  56.  
  57. ?>
  58. </ul>
  59.  
  60. <?php endwhile; ?>
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement