Change post thumbnail size on wordpress page

I made a separate wordpress page to display all of my featured images and they do display but I need help on how to make them display to their actual size not as really small images.

 <?php
$the_query = new WP_Query();
$the_query->query("cat=4&nopaging=true");

if ($the_query->have_posts()) : 
while($the_query->have_posts()) : $the_query->the_post();

  if(has_post_thumbnail()) : 
    the_post_thumbnail();
  endif;

endwhile; 
endif; 
wp_reset_postdata();
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); 
?>

<img src='<?php echo $image[0]; ?>' />

That is my code right now the page is http://rickwarren.veracitycolab.com/banners/

Read More

Thanks!

This is what my new code looks like and the images are still the same any thoughts?

 <?php
$the_query = new WP_Query();
$the_query->query("cat=4&nopaging=true");
if ($the_query->have_posts()) : 
while($the_query->have_posts()) : $the_query->the_post();

  if(has_post_thumbnail()) : 
    the_post_thumbnail();
  endif;

endwhile; 
endif; 
wp_reset_postdata();
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
?>

Related posts

Leave a Reply

3 comments

  1. Pass wp_get_attachment_image_src(...) a size parameter as well. In your case, you want ‘full’, so wp_get_attachment_image_src( $post->ID, 'full' ). From the Codex for that function:

    $size
    (string/array) (optional) Size of the image shown for an image attachment: either a string keyword (thumbnail, medium, large or full)
    or a 2-item array representing width and height in pixels, e.g.
    array(32,32). As of Version 2.5, this parameter does not affect the
    size of media icons, which are always shown at their original size.

        Default: thumbnail
    

    CSS rules could still ‘shrink’ the image though, so if it doesn’t work check the URL in the HTML source to confirm that the correct image is being requested, then check the stylesheet.

  2. The second argument of wp_get_attachment_image_src() is the size of the image to return. Using full here should give you the full size image.

    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
    

    EDIT: Of course this part of your code isn’t doing anything since it’s outside the loop.

    Change line 8 to the_post_thumbnail('full');

    You can delete everything after the line that begins with $image.... Codex page here