Skip to content

Instantly share code, notes, and snippets.

@rabbitinblack
Created September 20, 2013 05:48
Show Gist options
  • Save rabbitinblack/6633748 to your computer and use it in GitHub Desktop.
Save rabbitinblack/6633748 to your computer and use it in GitHub Desktop.
WordPress : WP_Query
<?php
$args = array(
'cat' => 1,
'posts_per_page' => 4
);
$custom_query = new WP_Query($args);
while($custom_query->have_posts()) : $custom_query->the_post(); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment