job.answiz.com
  • 1
Votes
name
name Punditsdkoslkdosdkoskdo

Can I add featured image to a page of 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!

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(); ?>

    
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; ?>
<?//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?

name
  • 1
Teacher

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(); ?>

    
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; ?>
<?//php get_sidebar(); ?> <?php get_footer(); ?>
  • 1
Reply Report