WordPress, taxonomy page not linking up

I have a custom post type named Sectors, which was made using the code below:

    add_action( 'init', 'wpsites_custom_post_type' );
function wpsites_custom_post_type() {

register_post_type( 'sectors',
    array(
        'labels' => array(
            'name'          => __( 'Sectors' ),
            'singular_name' => __( 'sector' ),
        ),
        'has_archive'  => true,
        'hierarchical' => true,
        'menu_icon'    => 'dashicons-heart',
        'public'       => true,
        'rewrite'      => array( 'slug' => 'sectors', 'with_front' => false ),
        'supports'     => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'revisions', 'page-attributes' ),
        'taxonomies'   => array( 'sectors', 'post_tag' ),
    ));

}

Then I have this code, which adds the categories to sectors:

Read More
add_action( 'init', 'create_sector_cat_categories' );

function create_sector_cat_categories() {
    register_taxonomy(
        'SectorCategories',
        'sectors',
        array(
            'label' => __( 'Sector Categories' ),
            'rewrite' => array( 'slug' => 'sectorcategories' ),
            'hierarchical' => true,
        )
    );
}

So, when I go to my sectors page, I currently have a list of the categories using the page ‘sectorcategories.php’.

Then when you click on a sector category, this goes to display all sectors in this category, using taxonomy-sectorcategories.php.

Now, the issue I have, is when I click onto a sector from here, It is using the index.php file, yet I have a page setup for this called single-sectors.php.

Does anyone know why it is not following its taxonomy?

Related posts

Leave a Reply

1 comment