I have a custom post type called dramas
/******* DRAMAS BEGIN *****************************************/
register_post_type('dramas', array(
'label' => 'Dramas',
'show_ui' => true,
'supports' => array('title', 'thumbnail', 'description'),
'labels' => array (
'name' => 'Dramas',
'singular_name' => 'Drama',
'menu_name' => 'Dramas'
),
'rewrite' => array( 'slug' => 'drama' ),
) );
I have set up a custom taxonomy
for the post
/* register taxonomy only for DRAMAS*/
register_taxonomy(
'drama_taxonomy',
'dramas',
array(
'hierarchical' => true,
'label' => 'Category',
'query_var' => true,
'rewrite' => true
)
);
I am able to get these post anywhere using following code
<?php
$args = array( 'post_type' => 'dramas', 'posts_per_page' => 4 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id,'drama_realityshow_home_page_thumb', true);
$terms = get_the_terms( $post->ID, 'drama_taxonomy' );
?>
<div class="prime-item">
<a href="<?php the_permalink(); ?>" target="_blank" class="standard-height">
<img src="<?php echo $image_url[0]; ?>" width="300" height="168" class="hoverZoomLink">
</a>
<div class="new-cat"><?php
foreach($terms as $term) {
echo $term->name;
} ?>
</div>
</div>
<?php endwhile; ?>
By using the above code I am getting dramas
custom post type's
- Thumbnail source
- Taxonomy term
- Permalink
When I hover over the I see the permalink / url www.mysite.com/drama/post-name
at the browser bottom as I expected.
But when I click on the link [ 'a' tag in the <div class="prime-item">
] I am getting 404 page.
I have single-dramas.php
in the theme folder. Even if I don not have that it should fall to single.php
but it's not.
The browser address bar shows www.mysite.com/drama/post-name
but displaying 404.
Also permalink edit option is NOT found at the right bottom of the editor title as always it's appeared.
why is this?
How can I get to single page / the permalink works for the post type dramas
? NOT to go to 404.
Admin Panel -> Setting -> Permalinks
and clickedsave
but NO luck.. still same 404