WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page thumbnail size not working (5 posts)

  1. lizzmo
    Member
    Posted 2 years ago #

    Here is the code I'm using:

    <?php if (has_post_thumbnail( $post->ID ) ): ?>
    <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail', $size='thumbnail' ); ?>

    I put the thumbnail size in the media section of the control panel and added <?php add_theme_support( 'post-thumbnails' ); ?> to function.php.
    But the image is coming up full size instead of cropped to thumbnail proportions. Please let me know how to fix it. Cheers!

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    If you're inside the Loop, you can just use:

    <?php if (has_post_thumbnail() ) the_post_thumbnail(); ?>

  3. lizzmo
    Member
    Posted 2 years ago #

    Alright its resizing the featured image now, but even though I have hard crop set to true its still doing a box resize. Any ideas?

    code in functions.php

    <?php
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 150, 105, true );
    ?>
  4. Jeremy Herve
    Member
    Posted 2 years ago #

    Do you have the same issue with fresh updated images?

    Indeed, if you changed the cropping method, you have to refresh your previously cropped images to get the new crop you want.

  5. lizzmo
    Member
    Posted 2 years ago #

    absolutely right, thanks! just had to delete and upload the image again.

Topic Closed

This topic has been closed to new replies.

About this Topic