Displaying data with condition base for specific Post Type

Explore our WordPress category, where you’ll find loads of helpful articles and tutorials for everyone, whether you’re just starting out or a pro developer. Learn about different WordPress themes and plugins that can be applied in various projects according to their specific requirements.
This code checks if the current WordPress post type is ‘post’. If the condition is true, it will display an h1 heading with the text “Post Type.”
<?php if (get_post_type() === ‘post’) : ?>

Post Type

<?php endif; ?>
<?php and ?> are PHP tags, indicating the beginning and end of PHP code.
if (get_post_type() === ‘post’) : starts the conditional statement. It checks if the current post type, obtained by get_post_type(), is equal to the string ‘post’.
Inside the conditional block, there is an <h1> heading with the text “Post Type.”
endif; marks the end of the conditional block.