Skip to content

Instantly share code, notes, and snippets.

@hirejordansmith
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirejordansmith/6a0d78568eba0ea60369 to your computer and use it in GitHub Desktop.
Save hirejordansmith/6a0d78568eba0ea60369 to your computer and use it in GitHub Desktop.
How to query for a single term in a custom post type
<?php
query_posts( array( 'post_type' => 'custom', 'taxonomy-slug' => 'term-slug' ) );
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<?php endwhile; endif; wp_reset_query(); ?>
<?php wp_reset_postdata(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment