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
- 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?
- Static Front Page problem
- Create single.php for specific category by category id
- Categories Template Assistance
- How to control template resolution if both Author and Category filter in place?
- Apply custom category template to subcategories
- get_query_var() and permalinks
- Retrieve all posts within tag OR category?
- Exclude category from Tag Template
- New Theme creation
- 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
- How to get data about category in category.php
- Override template file i subfolders
- editing fonts of category links from the_category() funtion
- 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
- How to show single category archive
- 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
- Category template to show different categories based on parent
- Does “show_option_all” in wp_list_categories do anything?
- Sub category templates
- Inside a loop, how to change CSS class based on category name?
- Custom taxonomy template for 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?
- Allow user to select categories that will display in post loop
- How do I retrieve the category ID (ugly permalinks) in my sub-navigation menu?
- Give posts a particular template based on the assigned category
- 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
- Template for product-category page [closed]
- Add Date & Author Meta to Category Archive 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]
- I would like to feature a tip on the homepage
- How to link to the page displayed by home.php?
- How can I include custom category and tag base in template files?
- Different header for each category
- Custom post type archive category page results in 404
- Include home page template in specific category template
- Include last post date in get_categories loop
- Products category search not working
- In if…else condition, the else statement shows even if if statement is correct
- Can’t display posts by filtering categories using isotope.js
- Category custom template is not showing correct posts
- Different templates for each category level
- Adding a category view to a page
- Different template for subcategories
- Display Taxonomies in loop with template args
- Choosing different templates for categories
- If it is a top level category show children otherwise show sibling categories
- Category Templates for Post Types not Working
- Having some trouble properly displaying Custom Post Types in templates
- How to get multiple loop in category.php, my scripts becomes madness
- Category base 404 – fix
- altering theme – content generated by PAGES not PORTFOLIO
- How do I get a single page navigation depending on the previous page?
- Add 1 category more to If_in_category statement
- Category Template – to be editable from the backend?
- WordPress 3.5 how to determine if user is on category listing or category edit screen?
- Display only one level subcategory in wordpress
- Get all first images of posts in same category
- have_posts is empty on category.php
- How to display the category featured images [closed]
- What is the point of using archive.php instead of index.php?
- How to make /category/ URL load properly instead of 404 error?