WordPress.org

Ready to get started?Download WordPress

Forums

WP User Frontend
Use Featured Image on Single Post? (3 posts)

  1. EricaMueller
    Member
    Posted 1 year ago #

    I'm wanting to allow people to upload a featured image for thumbnail use in the loop (home page, category archives, etc) but also have it insert the image in the post, before the content.

    Right now, I'm having people upload the image again, in the test box. But, some people aren't understanding that they need to do that, so I have single posts without images.

    What do I need to add to my theme to make this work?

    http://wordpress.org/extend/plugins/wp-user-frontend/

  2. RobReg
    Member
    Posted 1 year ago #

    Hi, this should help you:

    Here is what I did to fix this:

    open up single.php and find the line:

    <?php the_content(); ?>

    Just above that, or below if you want the image to appear after the content, put this:

    <?php
     if ( has_post_thumbnail()) : the_post_thumbnail('thumbnail');
     endif;
    ?>

    That should do the trick.

  3. EricaMueller
    Member
    Posted 1 year ago #

    RobReg,

    This was exactly what I needed!

    Because my theme, being a child theme of the Genesis framework, doesn't have a single.php file, I inserted the code below into my genesis_before_post_content Hook via Simple Hooks:

    <?php if ( is_single() ) {?>
    <center>
    <?php
     if ( has_post_thumbnail()) : the_post_thumbnail("thumbnail");
     endif;
    ?>
    <br><br>
    </center>
    <?php }?>

    Then I went to Appearance/Media and set my Thumbnail sizes to 400 x 400 and unchecked the proportions box so I'll get a nice sized image above my posts.

    I just wanted to share that bit in case anyone else is in the same boat.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic