For categories/taxonomies you can use get_queried_object to get the current category. From there you can easily get the name. So from your example:
if ( is_category() ) {
$cat = get_queried_object();
$heading = $cat->name;
}
Related Posts:
- Check if current category has subcategories
- wp_nav_menu not appearing for a couple pages
- wp_update_nav_menu_item() to insert categories
- How to get the url to tag & category base set by the user?
- Why adding Categories does not auto refresh in Backend while using my custom theme?
- is_archive() content being shown instead of is_category()
- Retrieve all posts within tag OR category?
- Edit the markup of categories list
- New Theme creation
- How to get data about category in category.php
- editing fonts of category links from the_category() funtion
- How to check category of of custom post type or not
- Set a them for all subset of category
- How to call custom category field data in theme?
- Different templates for different category tags
- Why category.php throw 404 in wordpress while calling paginate_links()?
- Woo Framework: woo_cat_featured not populating
- Inside a loop, how to change CSS class based on category name?
- Question on using custom structures for 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?
- Category page returns 404 error
- Show post categories
- Add description to categories menu in admin
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- How to add icon over specific thumb
- How to differentiate the homepage structure from the category page structure in WordPress template?
- How to detect /category and /tag base pages?
- WooCommerce shared categories
- Show the number of the post
- 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
- Media Library Categories
- How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?
- Change single.php template based on parent category
- Show posts from all categories
- If it is a top level category show children otherwise show sibling categories
- Lowest catagory link
- How to get multiple loop in category.php, my scripts becomes madness
- Category base 404 – fix
- altering theme – content generated by PAGES not PORTFOLIO
- Category Archives: Show posts categorized in parent category only
- WordPress 3.5 how to determine if user is on category listing or category edit screen?
- Display only one level subcategory in wordpress
- How can i hide the authors box from a specific set of categories and post types?
- Get all first images of posts in same category
- How to display the category featured images [closed]
- How to make /category/ URL load properly instead of 404 error?
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- How to show subcategories in categories else show posts
- How to remove the parentheses from the category widget
- Filter front page posts by category
- Root level category, tag, author and archive pages to work
- Archive pagination causing 404 with permalinks structure
- Get a list of Terms for a specific category
- Get a variable from object in array [closed]
- a-z list, categories and sub categories in loop
- Category slug $_SERVER[‘REQUEST_URI’];
- wp_dropdown_categories and custom taxonomy + custom post type
- Linking products to categories
- Query Posts Exclude Entire Category
- One Specific Category To Permalink
- Hide woocommerce category name from specific pages
- WordPress category widget only show categories with children
- Woocommerce custom category page with pagination [closed]
- Menus don’t work after 4.4 [closed]
- Custom post and category template pagination problem
- Trying to add cat_ID to array for showing an image for specific Category
- How to change amount of categories listed on dashboard?
- Exclude a category name using cat name
- How to get posts by category at /%category%/ url?
- Echo text using is_tag
- Cannon see subcategory in permalink
- Custom row actions on a specific category
- How to not display a category post on blog page?
- Show multiple categories in query using redux framework variable
- How to display a block only for a certain category page
- Assignt automatically two categories by author
- Get multiple category names from permalink
- How to remove an item from a custom Walker_Nav_Menu
- Dynamically display sub-categories on primary menu without adding them
- display number of posts by category Shortcode
- Custom permalink /%category%/%postname%/ produces 404 on each post
- How to display products with multiple conditions, product_id and category_id
- Split posts into 2 separate streams
- Outputting subcategory title AND items on Category page
- Conditions for single post
- Pages, Categories, and working with someone else’s code
- Category articles “read more” links not active
- Custom Fields to Category edit page, then displaying them in a template correctly
- How to create a custom loop ordered by Categories on a Page Template?
- Post thats in Two Categories, only want to display name for one
- 2 Categories using same template but one has a problem? [closed]
- Make a category my homepage
- WooCommerce Product Search Error
- Images as Categories
- Is there a standard “Archive” block that shows ALL posts from a specified category?