WordPress.org

Support

Support » Themes and Templates » Get any post image from uploads in the loop

Get any post image from uploads in the loop

  • Hi thank you in advance.

    My wordpress site generates 5 images when i upload. I am redesigning my theme and now want to use more than one size of thumbnail on the homepage.

    Previously I was only using a 172×88 thumb I got WordPress to start creating, now I would like to use the 120X120 thumb but i cannot seem to call this image into the loop.

    I get my original thumb like so.

    In functions:

    if ( function_exists( 'add_image_size' ) ) {
    	        add_image_size( 'cat-post-thumb', 172, 88, true );
    	}

    in the loop:
    <?php the_post_thumbnail('cat-post-thumb'); ?>

    This works fine, however I tried:
    functions

    if ( function_exists( 'add_image_size' ) ) {
    	        add_image_size( 'large-post-thumb', 120, 120, true );
    	}

    loop
    add_image_size( 'large-post-thumb', 120, 120, true );

    I think this may work for new images I upload but it is not working for legacy images and I need it too… I know the 120×120 images are there for all my old posts. How can I get them to be the thumbnail in the post?

    Thank you again.

    Matt

  • The topic ‘Get any post image from uploads in the loop’ is closed to new replies.
Skip to toolbar