I think perhaps what you want is either
<?php if ( !is_front_page() ) : ?>
<h2>
<?php wp_reset_query(); ?>
<?php echo $post->post_type; ?>
</h2>
<?php endif; ?>
if you’ve done a custom front page that shows the blog posts, or
<?php if ( !is_home() ) : ?>
<h2>
<?php wp_reset_query();
echo $post->post_type; ?>
</h2>
<?php endif; ?>
if your front page is a static page and the post list is on a blog page or you have the vanilla setup.
This will output the post type heading on all pages that run the template except the home page or the front page.
or
<?php if ( is_page('my-page-slug') ) : ?>
<h2>
<?php wp_reset_query();
echo $post->post_type; ?>
</h2>
<?php endif; ?>
if you have this on some other specific page.
Related Posts:
- How to count the length of a post title?
- Filter the blog title displayed in the header
- Blank on static home page?
- “Maximum function nesting level of ‘100’ reached” after adding a new filter
- String replace WordPress Site Title
- Customized title tag for each page in pagination?
- Browser title script ignoring is_page /else conditional [closed]
- Blank space at beginning of tag?
- Filter get_the_title to remove certain characters?
- get_page_by_title with an apostrophe in variable
- Locating Global Variables
- Set post title based on first h2 element in the content section
- An extra ‘ is displayed in the title
- Part of title duplicating but not sure how to remove from code – help?
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Remove the first 5 characters of the_title and orderby that
- Change title only in dynamic page
- Display custom post type title as text if post thumbnail is not available
- Change page title from page using php via php executed from page/post itself
- Reduce size of responsive title
- Run str_replace on title and save the output to a custom field
- Echo title attribute php
- change title page on search result
- woocommerce related product title length
- Split site title and apply different classes
- Insert content into head tag with function
- How do I choose not to display the title header on a specific page?
- Set document title through shortcode plugin
- how to replace h1 entry title with h2 in category pages only
- Posts title instead of Pages and Category titles – PHP WordPress
- Time Stamp In A WordPress Post Title That Does Not Keep Refreshing
- How can I get the custom post title?
- Site title not showing. Please help me
- How to display custom seo title before the loop?
- Put a span class in the shortened product title
- Allowing HTML elements in title widgets spacing problem
- “Page Array” displaying in title bar on Front Page
- Replace Underscore (_) on Space ( )
- my site show this symbol (::) between site title and tagline
- Display tab title as ‘blog tagline | blog title’
- Custom field in title
- Hide page title
- What is the best php version to use with WordPress?
- How to call a function only once (global variable scope)
- Where should I install a PHP library into WordPress so that code in a webpage can activate it?
- Does the debug.log do log rotation?
- How to make WordPress plugin check for database changes and then do something?
- Edit postmeta when user changes user role?
- Looping through WP_Post Object
- wp_get_attachment_url filter won’t accept two arguments
- Translating add to cart woocommerce button [closed]
- nowplaying.include.php Will Not Display Results
- Am I not understanding plugins?
- SetCookie simply not working
- Looking for most performant way to execute several similar WP queries within shortcodes
- Customize Time Stamp
- Combine two filters into a single call
- How to output widget
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- Display menu point only if there are published posts in that category
- What query string parameter is available for index.php, that works for both pages and blog articles?
- Sending data from custom inputs in WordPress comment form in the admin notification email
- export a csv file from the database with a cronjob
- How to set a min number of words for a blog post
- Modify custom field input data before creating a new post
- Ajax contact form return 0
- Get my site session in wordpress?
- Register a menu – Error Header
- Include style.css in the Child Theme with PHP
- Get user custom field value on function.php
- Add New Text Box To WordPress Twenty Seventeen Header
- WordPress homepage setup not working on first load
- Get the id of all images in a post
- Choose either excerpt or the_content
- Removed jQuery script from header.php , any problems?
- Dynamically display font icons in widget
- Setting a default thumbnail url if no thumbnail
- Need help for some PHP code
- Remove an action created by a Gravity Forms add-on
- Ajax search box displays nothing if taxonomy doesn’t exist
- PHP “warning include_once(): Failed to open stream” Simple HTML DOM in WordPress Child Theme
- How do I make the following articles collapse within the month?
- Notice : Array to string conversion on array_intersect user meta
- Get posts by id using shortcode
- Is it possible to replace ‘attachment’ with another word?
- Hide price excluding tax when price is empty
- Getting a value from a custom field from a page that shares a parent with the current page
- wordpress, Category ID
- PHP get_category() function redeclared
- How to trim content AND retain HTML?
- Save data of select list after clicking save
- Arrange Category post manually when displayed
- WordPress adding in site URL to header links
- Error on Include php:/usr/share/pear
- Alternative loop syntax error [closed]
- why my “recepie” category is not taken into account in my request
- Category slug inside another php code
- PHP block changed to comment by WordPress?
- Custom Filtering date with newsletter
- WordPress critical error after trying to update to 6.2 – Fatal error: Allowed memory size of 268435456 bytes exhausted