How can I add a featured image to a page?

I need the ability to add an image to a page, like a featured image. How can I do that, and how do I get the featured image to display in page.php? It can be a plugin if what I am asking can’t be done within WordPress itself out of the box.

Related posts

Leave a Reply

1 comment

  1. Eek! A 33% acceptance rate isn’t really going to do you any favours but lucky for you WordPress’ in-built post-thumbnail featured image functionality works for posts, custom post types and pages too.

    Add the following line into your theme functions.php file:

    add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
    

    Then in your page.php file and I stress that this must be used within the page loop (not outside of it) the following function will show your featured image on a page if it has one assigned to it.

    the_post_thumbnail()
    

    Adding a featured image to a page is the same process as adding one to a post. On the page editing screen you will see a metabox with a link that says, ‘Set a featured image‘ click that and you’re good to go. No plugins required.