DEV Community

Francisco Paul Sotelo Rocha
Francisco Paul Sotelo Rocha

Posted on

How to add featured image to a new wordpress theme

1) Add featured image setting on functions.php

function theme_post_thumbnails() {
add_theme_support( 'post-thumbnails' );
}

add_action( 'after_setup_theme', 'theme_post_thumbnails' );

2) Add the feature image to your post

Featured image

3) Add the image to your single posts

Here you have to go to single.php, or create that file in the case that you don't have it, and here write something like this:

Code post

4) Now go to your post, and... thats all!

Post result

Sayonara

Top comments (0)