I have created a custom post type "Portfolio" and a custom taxonomy "Kind" which includes "Websites", "Graphics", "Programming".

What I want to do is to create 3 different pages "Websites", "Graphics" etc. that will display the appropriate items as a list.

This is my code to display "Portfolio" posts :

<?php query_posts( array( 'post_type' => 'portfolio') ); ?>
    <?php if( is_tax() ) {
        global $wp_query;
        $term = $wp_query->get_queried_object();
        $title = $term->name;
    }  ?>

            <div id="content" class="clearfix">
                <div id="main" class="clearfix" role="main">
                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                    <?php $categories = get_the_category(); ?>
                    <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix single-post'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
                            <?php the_post_thumbnail( 'wpbs-featured' ); ?>
                            <div class="page-header"><h3 itemprop="headline"><?php the_title(); ?></h3></div>
                        </header> <!-- end article header -->

                        <section class="post_content clearfix">
                            <?php the_content(); ?>

                            </footer>--> <!-- end article footer -->

                    </article> <!-- end article -->

                    <?php endwhile; ?>          
                    <?php else : ?>
                    <?php endif; ?>

                </div> <!-- end #main -->    
            </div> <!-- end #content -->

Unfortunately, I can't manage to display only "graphics" or "websites" posts.

1 Answer 1


Create taxonomy archives, not pages.

Create three separate files called


Displaying the items/posts as a list is pretty simple, eg

<ul class="my-posts">       
 <?php while ( have_posts() ) : the_post(); ?>
  <li><h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
 <?php endwhile; ?>

You may also need to add the following to your arguments

'rewrite' => array( 'slug' => 'kind')

when you register your taxonomy

Update: Have a look at http://kovshenin.com/2012/how-to-add-taxonomies-to-your-custom-post-types-in-wordpress/ on how to add custom taxonomies to custom post types. I would, however, not create a new post type but instead a category called "Portfolio" and then create a single post template for this category, called single-portfolio.php, where you can customize the design easily. You can then further customize by replacing the call <?php get_template_part( 'content', 'single' ); ?> with your own <?php get_template_part( 'custom', 'single' ); ?>.

  • and how do I display only "websites" from taxonomy "Kind" ?
    – Radolino
    Commented Jun 11, 2013 at 10:28
  • Include the loop above inside taxonomy-kind-websites.php and then simply visit the taxonomy term archive and the posts with the term 'website' selected will display. You will find the url by clicking "view" under Posts > Kind > Websites in the admin area.
    – psot
    Commented Jun 11, 2013 at 10:48
  • Do you mean that wordpress picks up the name of taxonomy from the filename automatically ? In case of "taxonomy-kind-website.php" wordpress sees "website" ?
    – Radolino
    Commented Jun 11, 2013 at 11:00
  • Sorry I just deleted a comment. The terms aren't registered but created from the admin area of course. Make sure the term name is 'websites' if the file is taxonomy-kind-websites.php
    – psot
    Commented Jun 11, 2013 at 11:02
  • Yes, excactly, Wordpress gets the posts belonging to the "website" term if you have created the template taxonomy-kind-website.php.
    – psot
    Commented Jun 11, 2013 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.