I have a custom post type movies that I have defined in function.php
function create_post_type() {
register_post_type( 'movies',
array(
'supports' => array('title', 'editor' , 'excerpt' , 'custom-fields'),
'labels' => array( 'taxonomies' => 'mvgen',
'name' => __( 'movies' ),
'singular_name' => __( 'movies' ),
),
'public' => true,
'has_archive' => true,
)
);
}
add_action( 'init', 'create_post_type' );
Now the archive page and single page are working good. But I have defined two custom taxonomies for this post type, for example "DRAMA" and "Rock."
I want when user click on this taxonomy they get all post related to that particular taxonomy.
For that I have created page taxonomy-mvgen-drama.php
which is copied below:
<?php get_header(); ?>
<section class="blog_sect">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php echo get_the_date(); ?>
<p>CATEGORY: <?php the_category(', '); ?></p>
</p>
<!-- ----------------printing taxonomy for a specifuic post------------------ -->
<?php
?>
<br>
<p><?php echo "LANGUAGES :"." ".get_the_term_list($post->ID, 'mvgen', '' , ' , ') ?></p>
</b>
<?php endwhile; ?>
<?php endif; ?>
<?php get_footer(); ?>
</section>
<?php get_footer(); ?>
But whenever I click on this taxonomy it doesn't take me to taxonomy-mvgen-drama instead it takes me to index page with the url http://localhost/movies/mvgen/rock/
Can you help me with this?