How to check if its a post or page in wordpress

How to check if its a post or page in wordpress

If you want to check using “IF” statement then you can use following code:

<?php

if (get_post_type() === ‘post’) {
echo “This is a Single Post”;
}

if (get_post_type() === ‘page’) {
echo “This is a Single Page”;
}

?>

 

Please watch the video for better understanding.

 

Leave a Comment