A category page is an archive page. So is_archive()
will return true
on a category page. Try to push down is_category()
further, or use is_category()
before is_archive()
.
Like This
if ( is_search() )
{
// Search Result content
}
elseif( is_category() )
{
// Category archive content
}
// check for tag, taxonomy, date before
elseif ( is_archive() )
{
// Default archive content for *every* type of archive
}
else
{
// Default content for non-archives
}
Related Posts:
- Different templates for parent and children categories/taxonomies
- Which php file lists all the post of a category
- Set a them for all subset of category
- Different templates for different category tags
- Categories overview that links to page displaying posts
- What Must to Display the “mysite.com/category” URL?
- How to differentiate the homepage structure from the category page structure in WordPress template?
- Custom Archive Template for Multiple Categories
- Use different file includes for single.php
- Show posts from all categories
- Most efficient way to have 1 template for parent, 1 template for child categories?
- Template files not working for archives and categories
- How to make child categories recognize parent’s template displays
- Is it possible to manipulate the list of page templates?
- Different template for subcategories
- Check if current category has subcategories
- wp_nav_menu not appearing for a couple pages
- Preventing index.php?category_name=something from redirecting
- Make all subcategories use the template of its category parent?
- wp_update_nav_menu_item() to insert categories
- How to get the url to tag & category base set by the user?
- Display only deepest category on a single post?
- How do I set a specific template for sub-categories?
- How to Handle CSS for Multiple Header header.php Files?
- Template tags to display custom post type posts in category template?
- Why adding Categories does not auto refresh in Backend while using my custom theme?
- Static Front Page problem
- Exclude a category from the filed under list only on some templates
- Create single.php for specific category by category id
- Categories Template Assistance
- How to override Category rendering mechanism
- How to control template resolution if both Author and Category filter in place?
- Any tag pagination page (except the 1st page) loads index.php template instead of tag.php
- Apply custom category template to subcategories
- get_query_var() and permalinks
- Custom page for WooCommerce’s /product-category/
- Retrieve all posts within tag OR category?
- Edit the markup of categories list
- Code to pull in a PHP file named after the category ID
- WordPress Theme Development: How to redirect templates the right way?
- Exclude category from Tag Template
- New Theme creation
- How to make a Thumbnails Mosaic
- Are Category or Tag Archive Pages Possible?
- Possible to make a subdirectory that loops through a single category?
- Need Category RSS Feed that shows all posts
- Display Categories, Sub-categories, and Sub-sub-categories on separate pages
- WooCommerce IF statements not working
- How to get data about category in category.php
- Override template file i subfolders
- editing fonts of category links from the_category() funtion
- How to check category of of custom post type or not
- Category-slug.php not being used
- How to display only posts assigned to a particular, isolated, subcategory
- Highlight wp_nav_menu when category is selected
- Single page site with history.js
- How to call custom category field data in theme?
- Archive.php filtered by pre-determined category
- one category template for multiple categories
- How to show single category archive
- The default code for “posts_nav_link” on category.php isn’t working
- Only one post is showing on category page, why?
- Why category.php throw 404 in wordpress while calling paginate_links()?
- Updating category template to change how subcategories display
- How can I get categories IDs if multiple categories requested via URI?
- Woo Framework: woo_cat_featured not populating
- Category template to show different categories based on parent
- Does “show_option_all” in wp_list_categories do anything?
- How can I improve this taxonomy treating approach?
- Sub category templates
- Inside a loop, how to change CSS class based on category name?
- Custom taxonomy template for categories
- How to insert category list into post creation page, and retrieve chosen categories?
- how to force tag page layout to use same as search layout?
- Limit number of posts on a custom category template – breaking pagination
- Question on using custom structures for categories
- How can I display the number of post associated to a category in Twig/Timber WordPress? [closed]
- Getting the category title / description returns first matching post?
- Is it possible to have a template that works on multiple categories where the link address contains the specific category?
- Custom template for sub-sub-categories
- Allow user to select categories that will display in post loop
- Insert HTML content in WP Query at specific point
- How do I retrieve the category ID (ugly permalinks) in my sub-navigation menu?
- Give posts a particular template based on the assigned category
- Template hierarchy: how to let category.php conditionally-load archive.php?
- Category page returns 404 error
- How to use wp_list_categories with plugin category?
- Using if statement in index.php instead of creating separate template files
- Why is my sub-category template showing the wrong posts
- Template for product-category page [closed]
- Add Date & Author Meta to Category Archive Page
- Display subcategories selectbox on each category page
- Show post categories
- Add description to categories menu in admin
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- Displaying year once in category.php [duplicate]
- Category link redirect to custom template page instead of index.php?
- I would like to feature a tip on the homepage
- How to add icon over specific thumb