I'm developing a wordpress theme for any record label. Taking care of may be the video gallery.

I produced the gallery utilizing a custom publish type known as 'videos'. The code below is exactly what I put into my functions.php file to setup the publish type:

add_action( 'init', 'create_my_post_types' );
        function create_my_post_types() {

register_post_type( 'videos',
        array(
            'labels' => array(
                'name' => __( 'Videos' ),
                'singular_name' => __( 'Video' ),
                'add_new' => 'Add New Video',
                'edit' => 'Edit Video'
            ),
            'public' => true,
            'exclude_from_search' => false,
            'supports' => array( 'title', 'editor', 'thumbnail','page-attributes','excerpt' ),
            'rewrite' => array( 'slug' => 'videos', 'with_front' => false ),

        ));
    }

I additionally produced a custom taxonomy known as 'artists' in order to assign the artist title to every video I upload.

 add_action( 'init', 'create_videos_taxonomies' );

    function create_videos_taxonomies() {

        register_taxonomy(
            'artist',
            'videos',
            array( 
                    'hierarchical' => false,
                    'label' => 'Artist',
                    'query_var' => true,
                    'show_tagcloud' => true,
                    'show_ui' => true,
                    'rewrite'=>array('slug' => 'artists', 'with_front' => false)
                  )
            );
        }

At this time, everything works fine around the after sales and also the video page returns all the videos effectively.

On another section of this site, I've pages for every artist. On any kind of these artist pages, i must have the ability to loop through all the videos within the custom publish type I produced, and just return produces a given taxonomy. Below is my code to loop via a custom publish type:

<?php $loop = new WP_Query( array( 'post_type' => 'videos', 'post_child' => 0, 'posts_per_page' => 5 ) ); ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php the_post_thumbnail( 'video' ); ?>
<?php the_content(); ?> 
<?php endwhile; ?>

This effectively loops with the videos, and returns the five newest. I want this to loop through all of the videos having a specific taxonomy slug or ID. For example, I produced a taxonomy known as 'Smash Palace' and contains a slug of 'smash-palace' as well as an id of '17'. Any idea the way i can loop though this practice publish type and just return produces a given taxonomy?

I seem like you need to have the ability to query according to publish_type and taxonomy such as this:

<?php $loop = new WP_Query( array( 'post_type' => 'videos', 'taxonomy_name' => $term, 'post_child' => 0, 'posts_per_page' => 5 ) ); ?>

found similar question on SO: Wordpress, WP_Query with custom taxonomy and custom post type