neeraj rai
neeraj rai

Reputation: 13

Common category Page Of custom post type

I have created a custom post type named 'services' and added categories like 'data', 'design' and 'digital'. so want to create common template for all categories within 'services' post type. Please help me how can I create a common template. Thanks in advance.

Screenshot :- https://prnt.sc/1imuek1

Upvotes: 0

Views: 31

Answers (1)

Full Stop
Full Stop

Reputation: 853

For that, you need to create a single post file. like single-services.php here services is your post type name.

In that file need to add the header and footer and your custom code. check below code format

<?php get_header(); ?>

// your code here for the display custom post type

<?php get_footer(); ?>

Since you are using a custom taxonomy and not the native post categories you need to name your file taxonomy-{taxonomy}.php and in your case, it would be taxonomy-mycategories.php

Take a look at the section of the template hierarchy to display custom taxonomy archives.

Upvotes: 0

Related Questions