I'm using taxonomy categories to show my custom post type, but when I click on it, no page is linked. How do I create a page to display the results from categories?

I tryed like custom post type:


but not worked.

1 Answer 1


Did you create taxonomy-{your-slug}.php template ?
let's say the slug is 'locations'
so, it will be something like this taxonomy-locations.php

if you haven't created yet, create one and the template codes will look like this ,

 * Locations taxonomy archive
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
<div class="wrapper">
    <div class="primary-content">
        <h1 class="archive-title"><?php echo apply_filters( 'the_title',     $term->name ); ?> News</h1>

        <?php if ( !empty( $term->description ) ): ?>
        <div class="archive-description">
            <?php echo esc_html($term->description); ?>
        <?php endif; ?>

        <?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>

        <div id="post-<?php the_ID(); ?>" <?php post_class('post clearfix'); ?>>
            <h2 class="post-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
            <div class="content clearfix">
                <div class="post-info">
                    <p><?php the_time(get_option('date_format')); ?> by <?php the_author_posts_link(); ?></p>
                </div><!--// end .post-info -->
                <div class="entry">
                <?php the_content( __('Full story…') ); ?>
    </div><!--// end #post-XX -->

    <?php endwhile; ?>

    <div class="navigation clearfix">
        <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
        <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>

    <?php else: ?>

    <h2 class="post-title">No News in <?php echo apply_filters( 'the_title', $term->name ); ?></h2>
    <div class="content clearfix">
        <div class="entry">
            <p>It seems there isn't anything happening in <strong><?php echo apply_filters( 'the_title', $term->name ); ?></strong> right now. Check back later, something is bound to happen soon.</p>

    <?php endif; ?>
</div><!--// end .primary-content -->

<div class="secondary-content">
    <?php get_sidebar(); ?>
    </div><!--// end .secondary-content -->

<?php get_footer(); ?>   

here , you can customize as you want & be sure that you use your slug.

According to Wordpress Hierarchy,

If no taxonomy-specific template ( taxonomy-{your-slug}.php ) is found,

then the taxonomy that lists pages will use the archive template ( archive.php )

If no archive template is found, then the taxonomy that lists pages will use the index template ( index.php )

  • my taxonomy have a slug called tag-portfolio: register_taxonomy('tagportfolio', array('project'), array( 'rewrite' => array('slug' => 'tag-portfolio'), )); but i'm trying to create taxonomy-tag-portfolio but dont works... it still getting index.php Mar 9, 2013 at 7:40
  • thanks bro, was the $taxonomy string in <?php register_taxonomy( $taxonomy, $object_type, $args ); ?> i needed to use. now is working fine :} Mar 9, 2013 at 7:55

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.