You can use the WordPress Template Hierarchy.
Copy your category.php file and rename it.
category-{slug}.php – If the category’s slug is news, WordPress will look for category-news.php.
category-{id}.php – If the category’s ID is 6, WordPress will look for category-6.php.
category.php
You can also use template_include to conditionally display a template
add_filter( 'template_include', 'category_page_template', 99 );
function category_page_template( $template ) {
if ( is_category() ) {
$new_template = locate_template( array( 'your-template.php' ) );
if ( '' != $new_template ) {
return $new_template;
}
}
return $template;
}
Related Posts:
- WordPress Custom Search Form Displaying Unexpected Results
- Page template query with WP_Query
- Exclude or Include category ids in WP_Query
- How to prevent execution of default query, while preserving ability to use WP_Query in template?
- How to query only for products with status “in stock” in WooCommerce? [closed]
- WP_Query to show post from a category OR custom field
- get_posts with multiple categories
- How to stop wordpress to make the default query?
- $wp_query initiation?
- Executing Queries in tag.php
- ajax category filter
- Display recent posts from the same category as current post in sidebar
- How to filter by category in REST API, excluding posts also in other category term?
- Counting number of posts with Category B in Category A
- How to order category.php loop by ‘meta_value’?
- Use Transient API to cache queries for all posts in all categories?
- How can I display recent posts from a particular category in my header?
- Sorting Posts by custom field
- Which custom query am I in and how can I access its properties & methods?
- Single page theme
- WP Query with multiple categories – passing an array works?
- wp_query display posts from same category of the post
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- Finding WordPress Posts assigned to multiple categories
- Include posts from some categories while excluding from others
- Combine results of multiple WP_Query to resemble single WP_Query
- Is there a way to make this kind of loop shorter and nicer?
- Utilising an existing page while using the “s” query parameter
- wp_query is showing posts from other categories
- WP_Query Taxonomy categories filtering
- Hide products in uncategorized category from search results
- How to load a script code only in posts?
- Get posts in taxonomy randomly
- How to echo woocommerce category name
- How to display a list of posts in same child category as current post
- Slider won’t work with custom query
- How to generate feed for custom template
- WP_Query with one category in args shows other categories
- How to exclude a category name from showing?
- Loop categories by recent post
- How order posts from category by date and comment count?
- Get the child category ID of current category
- How to get posts by category and by choosing a taxonomy term?
- Related Posts Excluding Certain Categories
- Getting the permalink to the latest post from a category
- What is wrong with my WP_Query Arguments?
- Unable to paginate a custom page query
- Widgets: Show Recent Posts Only if the Posts Have Both Categories X and Y
- How to stack name list in non-alphabetical order?
- problem with the loop
- get_the_terms has strange result since version 6.0
- Post incorrectly excluded when using “category__in”?
- get_children() Archive Template
- Related posts by current posts child category
- Filter sub-category from checkbox form
- `offset` WP_Query argument dont work via `pre_get_posts`
- Use get_cat_ID to retreive multiple category IDs
- Function the_posts_pagination() not compatible with WP_Query arguments
- Filter products on category AND tag
- In a WP_Query can I force the results’ is_singular() to be set to false?
- adding pagination to a foreach loop in wordpress
- query hook parse_tax_query function takes no effect
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- How to use the Term Object from a custom select field in a query
- 3 posts from each existing category on one page
- How to display the category dropdown auto search list when key press?
- Categories In English version showing not canonical URL, instead shows query search result
- What code to use in an array to call the current sub-category?
- Get categories within specific term
- Related categories order posts by category
- How to show specify category template for both parent and child category
- How to display a post(by id) along with css in a page?
- Pagination for Category does not work
- Exclude parent categories from recent posts list
- Display All Top Child Categories / Taxonomy
- Query post by Category and custom file (ACF)
- Check the product in the cart from which category is and show message
- WP_Query showing all posts, except from category X, unless it’s also in Y
- Single query for multiple categories
- Display 3 levels of categories on page
- Filtering ‘Featured’ posts from a batch of category IDs
- Show posts from categories instead of tags
- Multiple values in WP_Query : category__and
- ACF: using two loops, the_field returns field content from another loop
- How to exclude posts by ID within a category/archive loop
- I have 3 categories, i want to display on a loop the last 3 of every category
- Adding Category in WP_Query Not Working
- display all posts from category with and without terms in chronological order
- Help displaying related categories
- Search Filter With Custom Taxonomy and Custom Fields : How do I handle it via plugin?
- Pull posts from all categories if quantity is not met?
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Category Archive not working for pages
- Show full category tree for a year with all post titles?
- Retrieving category pages from subcategory returns empty sets
- query.php – multiple is_category functions
- Display Count of posts
- Display post list within category list sorted by name [duplicate]
- Create multiple sections for all categories and then queries all the posts for each of those categories
- Passing query variables to a custom page template