0

I'm a newbie in WordPress and I've just created a new custom-taxonomy called categories under a custom post type called arts. Is there a way I can create a custom page to display the 'categories's custom type? Such that a user can navigate to arts/categories and see all the terms under the categories taxonomy.

raam86
  • 6,785
  • 2
  • 31
  • 46
sammyukavi
  • 1,501
  • 2
  • 23
  • 51

3 Answers3

1

Create a file in your theme folder named taxonomy-categories.php and include your loop inside it...

Sample loop here:

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post">
  <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
    <?php the_title(); ?>
    </a></h2>
  <?php the_conetent(); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>

This loop will display all your posts assigned to custom taxonomy named "categories"

For Detailed Information Check this: http://codex.wordpress.org/Template_Hierarchy

Himanshu Jain
  • 444
  • 1
  • 8
  • 23
0

save a file named taxonomy-categories.php and paste the following code in that file.

            <?php
            $args_pdf = array(
            'orderby'       => 'name',
            'order'         => 'ASC'
            );
            $terms = get_terms('categories', $args_pdf);                    
            foreach($terms as $term) {
                echo '<h1><a href="'.get_term_link( $term ).'">' . $term->name . '</a></h1>'; 
            } 
            ?>
Atif Tariq
  • 2,650
  • 27
  • 34
0

This loop will display all your posts assigned to custom taxonomy named "categories"

For Detailed Information Check this: http://hinhcuoidep.com.vn/ but i need load taxonomy category in home page but it dont work in main index template

Nhà Quê
  • 3
  • 4