Can I add featured image to a page (WordPress)

I know, we can add a featured image to a post WordPress. But I want to know, can we also add a featured image to a page. If so, please share how.

Thanks Guys!

Read More

I have static page call ‘homepage’ in a template called ‘HomePage Template’

This is the code for HomePage-Template.php

<?php
/*
 *  Template name: HomePage Template
 *  Description: Homepage Template use to create your home page as a default view.
 *
*/
?>
<?php get_header(); ?>

    <div class="grid-12">
        <?php//get page content and display ?>
        <?php if (have_posts()) : ?>
        <?php while (have_posts()) : the_post(); ?>
            <?//this will echo the page content ?>
            <?php the_content(''); ?>
        <?php endwhile; ?>
        <?php endif; ?>
    </div>

<?//php get_sidebar(); ?>

<?php get_footer(); ?>

Primary Question: Is there anything needed to activate or add a featured image option in the editor for pages?

Related posts

Leave a Reply

2 comments

  1. WordPress defaults to only having featured images “turned on” for posts.

    To activate featured images for pages, simply add this line (to functions.php or elsewhere):

    add_theme_support( 'post-thumbnails' );
    

    That’s it!

    Still not working?
    If you still don’t see the featured-image meta box in the editor for pages, be sure to check the Featured Image checkbox in the Screen Options dropdown (top right tab in the editor when on a new/edit page/post screen).

  2. you can get page thumbnail same as like post

    <?php
    /*
     *  Template name: HomePage Template
     *  Description: Homepage Template use to create your home page as a default view.
     *
    */
    ?>
    <?php get_header(); ?>
    
        <div class="grid-12">
            <?php//get page content and display ?>
            <?php if (have_posts()) : ?>
            <?php while (have_posts()) : the_post(); ?>
                <?//this will echo the page content ?>
            <?php 
             if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
             the_post_thumbnail();
             } 
             ?>
                <?php the_content(''); ?>
            <?php endwhile; ?>
            <?php endif; ?>
        </div>
    
    <?//php get_sidebar(); ?>
    
    <?php get_footer(); ?>