Skip to content

Instantly share code, notes, and snippets.

@emaildano
Created February 13, 2014 19:52
Show Gist options
  • Save emaildano/8982538 to your computer and use it in GitHub Desktop.
Save emaildano/8982538 to your computer and use it in GitHub Desktop.
Query custom post type and reset query.
<?php
$args = array( 'post_type' => 'trainers', 'posts_per_page' => -1 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment