Skip to content

Instantly share code, notes, and snippets.

@yellowberri-snippets
Last active December 21, 2015 03:29
Show Gist options
  • Save yellowberri-snippets/6242595 to your computer and use it in GitHub Desktop.
Save yellowberri-snippets/6242595 to your computer and use it in GitHub Desktop.
PHP: WP: WP_Query
<?php
$args = array (
'post_type' => 'post',
'posts_per_page' => -1,
'status' => 'publish'
);
$query = new WP_Query( $args );
?>
<?php if ($query->have_posts()) : ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment