Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type taxonomy created:

function wps_register_paneltype_tax() {
    $labels = array(
        'name' => _x( 'Panel Category', 'taxonomy general name' ),
        'singular_name' => _x( 'Panel Category', 'taxonomy singular name' ),
        'add_new' => _x( 'Add New Panel Category', 'Panel Category'),
        'add_new_item' => __( 'Add New Panel Category' ),
        'edit_item' => __( 'Edit Panel Category' ),
        'new_item' => __( 'New Panel Category' ),
        'view_item' => __( 'View Panel Category' ),
        'search_items' => __( 'Search Panel Category' ),
        'not_found' => __( 'No Panel Category found' ),
        'not_found_in_trash' => __( 'No Panel Category found in Trash' ),
    );

    $pages = array( 'panels' );

    $args = array(
        'labels' => $labels,
        'singular_label' => __( 'Panel Category' ),
        'public' => true,
        'show_ui' => true,
        'hierarchical' => false,
        'show_tagcloud' => false,
        'show_in_nav_menus' => true,
        'rewrite' => array('slug' => 'panel-type'),
     );
    register_taxonomy( 'panel_type' , $pages , $args );
}
add_action( 'init' , 'wps_register_paneltype_tax' );

And I am calling it here:

function hac_class_template() {

    // Query Arguments
    $args = array(
        'post_type' => 'panels',
        'category' => 3,
        'posts_per_page' => 3
    );  

    // The Query
    $the_query = new WP_Query( $args );

    // Check if the Query returns any posts

    if ( $the_query->have_posts() ) {

        // Load the Panels ?>

            <?php
            // The Loop
            while ( $the_query->have_posts() ) : $the_query->the_post(); ?>


                <div class="col-sm-4">

                    <?php 

                    // The Classes's Image
                    the_post_thumbnail( 'wpbs-class' );


                    ?>

                    <div class="overlay">
                        <?php echo the_title( '<h3>', '</h3>' ); ?>
                        <a class="button" href="<?php echo get_permalink(); ?>" title="Learn More">Learn More</a>
                    </div>

                </div>


                <?php endwhile; ?>  

    <?php }

    // Reset Post Data
    wp_reset_postdata(); 

But I can't get it to display just that one category, it shows all.

Any help?

Thanks

share|improve this question
    
Figured it out thanks to this article: wp.smashingmagazine.com/2012/11/08/… $args = array( 'post_type' => 'panels', 'tax_query' => array( array( 'taxonomy' => 'panel_type', 'field' => 'slug', 'terms' => 'exhibit' ) ), 'posts_per_page' => 3 ); –  danjvos Oct 25 '13 at 3:16
    
Please add that as answer. You can mark it as solution in two days. Thanks. –  kaiser Oct 25 '13 at 5:57
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.