• triplecomp

    (@triplecomp)


    Hi all,

    My posts feature image that is used to display when viewing in a category. I want to also show it at the top of the post itself.

    I used this code in my single.php to achieve this:

    <?php if ( has_post_thumbnail() ):?>
    <div class=”featured-image-wrap”><?php the_post_thumbnail(); ?></div>
    <?php endif; ?>

    Now my issue is that when I put in the standard wordpress sizes they don’t work well across multiple screens. So I would like it so that the image is responsive.

    I am meant to put the size between () of <?php the_post_thumbnail(); ?> but I don’t know how to do this to make it responsive

    Could someone kindly help me.

    Many thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I usually use the_post_thumbnail('full') inside a div that has “width:100%” in CSS.

    Thread Starter triplecomp

    (@triplecomp)

    Hi Steve,

    Thanks for the reply. I tried full but it made the image its full size on mobile instead of width 100%.

    How do I create the css for the div?

    Im not too tech savvy when it comes to these things!

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Please provide a link to a page on your site where we can see this. Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Want to show feature image at the top of post’ is closed to new replies.