Reputation: 39
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/
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' );
?>
Upvotes: 1
Views: 908
Reputation: 273
If it still hasn't changed after you've added the 'full' parameter you might want to try the Regenerate Thumbnails plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/
Usually it helps for me when I've been messing around with custom thumbnail sizes.
Upvotes: 2
Reputation: 11852
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
Upvotes: 1
Reputation: 2850
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.
Upvotes: 1