skip to Main Content
Menu

Enable Featured Image In WordPress

First, in the theme’s functions.php file, declare that your theme supports this feature by writing below code. This will enable the UI in the WP Admin.

add_theme_support( 'post-thumbnails');

That will enable Post Thumbnail UI for both Post and Page content types. If you’d only like to add it to one, you can do it like this :

add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts

add_theme_support( 'post-thumbnails', array( 'page' ) ); // Add it for pagesBy this way you can enable featured image feature for post and page or for only page or for only post in your WordPress blog. Now one more thing that how we can show this featured image on out site. So there is one function by which you can show this featured image on your site which is given below :

<?php the_post_thumbnail( 'thumbnail' ); ?>;

Please write this function inside while loop. Wherever you write this function it will show featured image for that post.

Alphonse

Editorial Staff at ETN Multimedia is led by Alphonse Tan. Page maintained by Alphonse Tan

Back To Top