You can use single_term_title()
:
<h3><?php single_term_title(); ?></h3>
To hide it if there are no posts, use the if ( have_posts() ) :
function:
<?php if ( have_posts() ) : ?>
<h3><?php single_term_title(); ?></h3>
<?php endif; ?>
If not an archive, you can use get_term_by()
to get the term object for the term and then echo the name:
$term = get_term_by( 'slug', 'book-1-chapter-1', 'book' );
?>
<h3><?php echo $term->name; ?></h3>
Related Posts:
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- How to break up php code to avoid echo
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- enumerating custom taxonomies?
- Custom Taxonomy Link Text Echo Name Not Slug
- I want to show image from custom field image on my custom page template
- Dynamic Stylesheet loads but doesn’t finish
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Filter Select results based on selection
- Using loop pagination on single.php
- Loop with slider (slider not loading)
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- Show css depending on activity type in BuddyPress activity-loop [closed]
- Grab posts by multiple categories
- Iterate through posts based on array of categories
- How to get original custom taxonomy slug after the slug has been rewritten?
- get author_name from queried post
- Displaying Woocommerce Product Category in WordPress
- How can I add extra word in permalink when someone click download button?
- Displaying custom taxonomy on WooCommerce product page
- Increase offset while looping
- Blog posts repeat
- How to add condition in wordpress loop? [closed]
- Woocommerce : Can’t get product info in loop
- How to set variable, pass it to a partial file and remove it after?
- how to refresh div on template part?
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Alert Bar section within WP loop is displaying even though there are no posts
- remove post that has no content
- How to get post’s current parent term ID?
- Display category name only once inside loop
- Can’t find infinite loop cause
- Checking array against author id in loop
- How do I Turn This Into An if statement?
- multiple taxonomy select display only one in front end
- Display parent and child taxonomies in separate drop down select fields
- Load wordpress content in other domain
- How to show only subcategories in parent category not parent category?
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- Checkbox doesn’t stay checked, conten
- need help with existing code showing subpages
- Custom field values to taxonomy terms
- post thumbnail, conditions, else wont work
- Widgets in the loop if active
- Pull Tags But Not as Links
- List posts that don’t have a specific tag?
- Changing the_posts_navigation() html output
- Can we count the WordPress Loop
- Get post id within comments loop
- Syntax error when I try to insert my loop into an unordered list? [closed]
- WP_Query fails despite having 1 post
- Add content after the first post in WP Loop
- wp_query get the 2nd post
- Loop stopped working
- How to get post ID in a Page?
- Custom Pagination is Broken
- Display an image if odd number of posts in grid
- Copy taxonomy terms from one post to another programmatically
- How to loop through all the attached images in a post, and get their url one by one
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- PHP Warning: strip_tags() expects parameter 1 to be string?
- Store post content in a php variable and output them using for loop
- How to add div blocks after certain set of post
- Echo a shortcode div after every 3 posts
- How to avoid duplicates when creating recent network posts
- How to overwrite orderby with add_query_var
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Why in my theme I can’t see all the statics content under the posts?
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- Control content before and after custom post type loop
- Is the 404 page automatically displayed if a loop returns nothing?
- How do I remove a category from a wordpress loop>
- variable value disappears in a second loop
- Last class on last headline?
- working with term_relationships table
- Show recent posts starting at a specific number archive
- How to filter custom taxonomy term name, slug, and description?
- get_the_ID() in the footer returns wrong value
- How to get the last category name of a child category?
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- WordPress query undefined offset in loop
- Ajax filter button display all posts
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- Hierarchical taxonomy list with modificated term links
- How to unlink all posts from tracking same amount of views
- Use get() method to grab all categories and output inside another method
- Issue with custom loop in Archive page
- Why my loop isn’t working? [closed]
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Only show first image in foreach loop
- use loop to return blog details
- How to get current post category details inside “loop”?
- Show the section only if custom taxonomy was chosen
- How to pass current loop data into nested loop
- Exclude product attributes from taxonomy terms loop
- Get all posts as an array ID => Name
- How to get post ID from button and pass title to Modal
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- WP Query Leads to 502 Bad Gateway (Timeout Because Query Takes Too Long)