title: Wordpress: looping though custom post types and only return results in a given taxonomy
body: <p>I am creating a wordpress theme for a record label. One aspect is the video gallery. </p>
  
  <p>I created the gallery using a custom post type called 'videos'. The code below is what I placed in my functions.php file to set up the post type:</p>
  
  <pre><code>add_action( 'init', 'create_my_post_types' );
          function create_my_post_types() {
  
  register_post_type( 'videos',
          array(
              'labels' =&gt; array(
                  'name' =&gt; __( 'Videos' ),
                  'singular_name' =&gt; __( 'Video' ),
                  'add_new' =&gt; 'Add New Video',
                  'edit' =&gt; 'Edit Video'
              ),
              'public' =&gt; true,
              'exclude_from_search' =&gt; false,
              'supports' =&gt; array( 'title', 'editor', 'thumbnail','page-attributes','excerpt' ),
              'rewrite' =&gt; array( 'slug' =&gt; 'videos', 'with_front' =&gt; false ),
  
          ));
      }
  </code></pre>
  
  <p>I also created a custom taxonomy called 'artists' so I can assign the artist name to each video I upload.</p>
  
  <pre><code> add_action( 'init', 'create_videos_taxonomies' );
  
      function create_videos_taxonomies() {
  
          register_taxonomy(
              'artist',
              'videos',
              array( 
                      'hierarchical' =&gt; false,
                      'label' =&gt; 'Artist',
                      'query_var' =&gt; true,
                      'show_tagcloud' =&gt; true,
                      'show_ui' =&gt; true,
                      'rewrite'=&gt;array('slug' =&gt; 'artists', 'with_front' =&gt; false)
                    )
              );
          }
  </code></pre>
  
  <p>At this point, everything works fine on the backend and the video page returns all of the videos successfully. </p>
  
  <p>On another area of my website, I have pages for every single artist.  On any one of these artist pages, i would like to be able to loop through all of the videos in the custom post type I created, and only return results in a given taxonomy. Below is my code to loop through a custom post type:</p>
  
  <pre><code>&lt;?php $loop = new WP_Query( array( 'post_type' =&gt; 'videos', 'post_child' =&gt; 0, 'posts_per_page' =&gt; 5 ) ); ?&gt;
      &lt;?php while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); ?&gt;
  &lt;?php the_post_thumbnail( 'video' ); ?&gt;
  &lt;?php the_content(); ?&gt; 
  &lt;?php endwhile; ?&gt;
  </code></pre>
  
  <p>This successfully loops through the videos, and returns the 5 most recent. I need this to loop through all the videos with a specific taxonomy slug or ID. For instance, I created a taxonomy called 'Smash Palace' and it has a slug of 'smash-palace' and an id of '17'. Any idea how I can loop though this custom post type and only return results in a given taxonomy?</p>