You can check if a category has a parent, if it does it is a child category.
if( is_category() ){
$this_category = get_queried_object();
if( 0 != $this_category->parent ){
echo 'category has parent';
}
}
Related Posts:
- what is the action hook code to supporting product category condition in single product page of woocommerce?
- has_category() for parent category
- functions.php conditional tag – only show in single.php?
- Is there a reason I cannot get the current category in a loop?
- Echo text using is_tag
- Conditional category & tag statement
- Regarding Tags And Categories
- Sidebar by Category Conditional Statement not functioning
- Multiple if statements with else for get_the_category [closed]
- How can I hide the category term for posts with none set?
- Weird html output of single_cat_title – is not inside of the html element?
- Display all posts from all categories with pagination
- is_category() function
- Create terms when registering taxonomy?
- How to create a widgetized sidebar for every category dynamically?
- How do I edit pre_get_post for the category the user is currently in?
- Remove “Category Archives: title” at the top of a category page [duplicate]
- Category Alphabet List Broken
- WooCommerce – Display product child categories from specific parent
- Custom Stylings for category pages
- If newest post of category is newest post in general, skip first post of category
- Taxonomies for WordPress Media Library [duplicate]
- How do I automatically put categories and their descriptions on a WP Page?
- Taxonomy filter all children
- Bulk category update is not updating
- How to enable category hierarchy for links?
- WC 3.x Get categories from variable product of the cart
- Stick multiple posts in a single category
- Display category name on featured image in wordpress excerpt
- I need to create a search form that will display search results from specific category
- URL path for wordpress categories
- Automatically adding categories and authors in custom menu?
- Second level subcategory
- Checkboxes in the category list?
- Automatically exclude categories from metabox based on title
- Making the category & tag Description textarea bigger
- How to display post categories within the Latest Posts block?
- How do I output all category with custom field?
- Add /category/ to an author archive page
- Remove subcategory and category with some rules from permalink
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Use Tag input metabox style for Categories
- Does “show_option_all” in wp_list_categories do anything?
- redirecting from a general category page to another specific one
- Show matching categories in search page
- How to hide category name
- Categories are not listing their respective products
- Pagination on category.php and tag.php not working
- How to do paging in the loop?
- query_posts not reading correct categories
- Displaying list of subcategories and not parent category
- how to nest specific category thumbnails inside different containers
- Eliminate word from $term->name
- Is there any way to check which wordpress categories was created by which user?
- Adding a block with query in homepage
- Showing HTML if Post is In Certain Taxonomy Term
- multiple values in an array for category__and does not work with WP_Query
- Category view with contents of [gallery]s shown
- How can I include custom category and tag base in template files?
- Category List with custom urls
- query_post problem
- Get a list of all links on a page?
- Load the last post of a category
- Add properties to term object
- Display all Categories
- custom wp_list_categories in single.php
- How to target all woocommerce categories that don’t have any subcategories in them?
- Is this process OK to replace URL structure?
- How can i echo next and previous custom category from a Taxonomy
- how to give different template to each subcategory from same parent category?
- No hierarchy in wp_list_categories with child of and depth
- How to check a category checkbox using JavaScript
- Need help to structure our a complex hierarchy
- global categories – Share specific categories in wordpress multisite
- WordPress update 4.7 – the 70.000+ news posts became “Uncategorized”
- create post with main category and other categories from admin panel
- How Can Hide Define Category in Post Contents?
- How to auto update post title and slug with category name when post status is updated
- get_posts – require all categories
- 404 error when i try to search by category or by tag
- Choosing different templates for categories
- Problem with wp_list_categories
- How do you add Author and date Published on Category Pages?
- hierarchical taxonomy in permalinks? using same slug
- Display one post on category.php: Wrong featured image
- WordPress Numeric Pagination with Query String [duplicate]
- Changing Permalinks for Category Pages Only
- Taxonomy for custom post type not found
- Twenty Eleven Theme [duplicate]
- display certain category on custom template page
- Get post by Category in custom template
- Ajax call activate after submit in edit-tags.php page
- How can I get this code to only output one link?
- Assign a category by user and customize the edit-tags.php?taxonomy=category page
- comments_number fails to print
- Sorting Woocommerce products by category and attributes
- How to get Woocomerce categories count
- How to show child category name & post from it’s parent [closed]
- Open everything in new tab
- CPT Custom post type Tags & Categories not showing for ‘Editor’ user in editor