Posted By

thescottlee on 06/08/12


Tagged

wordpress WPQuery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

idisrupt


Sample WP_Query


 / Published in: PHP
 

For more parameters: http://codex.wordpress.org/ClassReference/WPQuery#Parameters

  1. <?php
  2.  
  3. // Start WP_Query for only the ID's from above
  4. $first_query = new WP_Query(
  5. 'post_type' => 'page',
  6. 'post__in' => array(6,7,8),
  7. 'category_name' => 'stuff',
  8. )
  9. );
  10.  
  11. ?>
  12.  
  13. <?php while($first_query->have_posts()) : $first_query->the_post(); ?>
  14. <?php the_title(); ?>
  15. <?php endwhile; ?>
  16. <?php wp_reset_postdata(); ?>

Report this snippet  

You need to login to post a comment.