WordPress.org

Ready to get started?Download WordPress

Forums

Get any post image from uploads in the loop (1 post)

  1. matt-tyas
    Member
    Posted 1 year ago #

    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 172x88 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 120x120 images are there for all my old posts. How can I get them to be the thumbnail in the post?

    Thank you again.

    Matt

Topic Closed

This topic has been closed to new replies.

About this Topic