WordPress.org

Ready to get started?Download WordPress

Forums

Featured Images for Posts but not Pages? (3 posts)

  1. Sora57
    Member
    Posted 1 year ago #

    There is a "set featured image" option for my posts but not my pages. I want to be able to set featured images for my pages.

    I know I have to do something to the loop in the index.php file, because that's the one that works for static pages?

    Below is the code for what I think is the loop part on the index.php page.

    Total n00b...what do I do from here?

    <?php
    					/* Run the loop to output the page.
    					 * If you want to overload this in a child theme then include a file
    					 * called loop-page.php and that will be used instead.
    					 */
    					//get_template_part( 'loop', 'page' );
    					 wp_reset_query();
    						if ( have_posts() ) : while ( have_posts() ) : the_post();
    						the_content();
    						 endwhile;
    						else:
    						endif;
    					wp_reset_query();
    					?>
  2. If you want to add a featured image to that code, you'll need to use the_post_thumbnail function.

    Have a look at the details and examples here - http://codex.wordpress.org/Function_Reference/the_post_thumbnail

  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    also check the 'screen options' tab near the top right on the 'edit page' page in the dashboard, and make sure 'Featured Image' is ticked.

Topic Closed

This topic has been closed to new replies.

About this Topic