What you want to do is impossible without a page.php
type of template. There is no template hierarchy that support what you want to achieve. It works exactly the same with categories. taxonomy-categorycourses.php
will not display a list of categorycourses
, so would category-categorycourses.php
if categorycourses
was a normal category. If you click on categorycourses
, you will be taken to a page that will display posts from that taxonomy or category.
If you need to show a list of terms or categories under a taxonomy, you will need to create a custom page.php
template and use get_the_terms()
to get a list of all the terms/categories attached to a taxonomy. wp_list_categories( $args )
will output the list, so you can modify this to display what you need. You can make a copy of your themes’ page.php
template and call it something like page-tax.php
You need to change the loop in this template. Here is an example for the twentyfourteen theme.
<?php
/**
* Template Name: Page Tax
*/
get_header(); ?>
<div id="main-content" class="main-content">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
$taxonomy = 'brands';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title="";
$args = array(
'taxonomy' => $taxonomy,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title
);
?>
<ul>
<?php wp_list_categories( $args ); ?>
</ul>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'content' ); ?>
</div><!-- #main-content -->
<?php
get_footer();
Just remember to change $taxonomy = 'brands';
to your taxonomy name. You can now create a new page in the “Add New Page” screen, set your page slug to the taxonomy name , and select this template. You can now enter http://server/categorycourses/
and you will be directed to this page you created.
Original Answer
Your answer is right in the link you provided. The codex states it perfectly, you just need to implement it correctly. Your template should be called taxonomy-categorycourses.php
. Please refer to the link you provided
UPDATE1
Hit me like a ton of bricks, had the same problem a while ago with a CPT, and I missed that when I looked at your code. For your custom template to work, you need to add 'has_archive' => true,
to your arguments when registering your custom post type. For your info, go and check registering taxonomies and registering custom post types