Skip to content

Instantly share code, notes, and snippets.

@derekshirk
Last active August 29, 2015 14:16
Show Gist options
  • Save derekshirk/7472a8bdb1a27f75152a to your computer and use it in GitHub Desktop.
Save derekshirk/7472a8bdb1a27f75152a to your computer and use it in GitHub Desktop.
WordPress-custom-query-loop-basic
<?php
$query = new WP_Query();
$query->query(array(
'post_type' => 'service',
'posts_per_page' => -1
));
$post_count = $query->post_count;
$count = 1;
?>
<?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
//
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment