Display Featured Image in Post/Page

Featured image in WordPress is an amazing feature. It let’s you upload an image that can be used as a thumbnail or any photo for your post or page.

To get the featured image and show it on the page, use the code below:

I also included a code to show if the featured image doesn’t exist. In the sample above it will show a default image.

2 responses to “Display Featured Image in Post/Page”

  1. chalavi says:

    About “Display Featured Image in Post/Page”

    Hi monsterTUT,

    Thank’s for this info …I need it
    but in which file and which lines in the file ?


  2. monstertutor says:

    You need to paste it on the template file of your page or post. usually it’s single.php for post and page.php for pages. You may paste it inside your loop or anywhere you want to show the featured image

Leave a Reply

Your email address will not be published. Required fields are marked *