WordPress Custom Post Taxonomy no t working

I have made a custom post Name Work then i was display it on my home page. Then i make a Custom post single page it’s works fine but when i make a custom post (Works) Taxonomy then i am trying to show custom taxonomy single page but it’s not working it’s continuously show custom post single page.

Custom post Works with designer-works taxonomy:

function designer_register_post_type() {
$labels = array(
‘name’ => _x(‘Designer’, ‘post type general name’),
‘singular_name’ => _x(‘Designer’, ‘post type singular name’),
‘add_new’ => _x(‘Add New Designer’, ‘exhibition’),
‘add_new_item’ => __(‘Add New Designer’),
‘edit_item’ => __(‘Edit Designer’),
‘new_item’ => __(‘New Designer’),
‘view_item’ => __(‘View Designer’),
‘search_items’ => __(‘Search Designer’),
‘not_found’ => __(‘Nothing found’),
‘not_found_in_trash’ => __(‘Nothing found in Trash’),
‘parent_item_colon’ => ”
);

$args = array(
‘labels’ => $labels,
‘public’ => true,
‘publicly_queryable’ => true,
‘show_ui’ => true,
‘query_var’ => true,
‘menu_icon’ =>’dashicons-welcome-view-site’,
‘rewrite’ => true,
‘capability_type’ => ‘post’,
‘hierarchical’ => false,
‘menu_position’ => null,
‘supports’ => array(‘title’,’editor’,’thumbnail’)
);

register_post_type( ‘designer’ , $args );
}

add_action(‘init’, ‘designer_register_post_type’);

register_taxonomy(“designer-category”, array(“designer”), array(“hierarchical” => true, “label” => ” Categories”, “singular_label” => “Designer”, “rewrite” => true));

Designer.php

‘designer’,
‘posts_per_page’ => 12,
‘order’ => ‘DESC’,
‘orderby’ => ‘date’,
));
?>
have_posts() ) : ?>
have_posts() ) : $the_designer_query->the_post(); ?>

“>
‘card-img-top’));
}

?>
</a>
<div class=”card-body”>
<a href=”<?php the_permalink();?>”><h5 class=”card-title text-center”><?php the_title();?></h5></a>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php esc_html_e( ‘Sorry, no posts matched your criteria.’ ); ?></p>
<?php endif; ?>
</div>
</div>
</section>

single-designer.php

‘designer-category’,
‘hide_empty’=>false
));
foreach ($all_terms as $value) {
// echo $value->slug;
}

?>
<?php
$args = array(
‘post_type’ => ‘designer’,
‘posts_per_page’ =>-1,
‘orderby’ => ‘date’,
‘designer-category’ =>$value->slug,
);
$query = new WP_Query( $args );
?>
<?php if ( $query->have_posts() ) : ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class=”col-md-3 col-sm-6 col-xs-12″>
<div class=”div single-work-product”>
<div class=”card” style=”width: 100%;”>
<a href=”<?php the_permalink();?>”>
<?php
if(has_post_thumbnail()){
the_post_thumbnail(‘designer_image_short’,array(‘class’=>’card-img-top’));
}
?>
</a>
<div class=”card-body”>
<a href=”<?php the_permalink();?>”><h5 class=”card-title text-center”><?php the_title();?></h5></a>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( ‘Sorry, no posts matched your criteria.’ ); ?></p>
<?php endif; ?>
</div>
</div>

taxonomy-designer-category-{Works}.php

But not working what can i do any suggestion?

Read more here:: WordPress Custom Post Taxonomy no t working

Leave a Reply

Your email address will not be published. Required fields are marked *