so this is sort of a continuation of another question that I had to ask recently. I wanted to start another conversation, since technically my last question was answered. The last question is here: Display Post Thumbnail Without Being Featured Image if you would like to get caught up on where I was, and where I’m at now.
I used to call the post’s thumbnail with this:
if ( has_post_thumbnail() ) {
the_post_thumbnail();
With no issues. Then I started to think that I would need it so that my client didn’t always have to set a featured image for every post. Well, with no featured image, there was so post thumbnail being shown in the post’s excerpt. So, because of the answer that I was given in the last question(link posted above), I am now using the Get The Image plugin along with this:
if (
has_post_thumbnail() ) {
the_post_thumbnail();
}
else
{
get_the_image( array('size' => 'thumbnail', 'image_class' =>
'wp-post-image'));
}
Now, if there is no Featured Image chosen for a post, it picks the first image of the post’s gallery, since there will always be a gallery for each post.
The problem now is that on the actual post, I have had it set so that the Featured Image is shown in full size right in the middle of the page. Thanks to this in my functions.php file:
// This theme displays full size featured image on the Post's page
function InsertFeaturedImage($content) {
global $post;
$original_content = $content;
if ( current_theme_supports( 'post-thumbnails' ) ) {
if ((is_page()) || (is_single())) {
$content = the_post_thumbnail('page-single');
$content .= $original_content;
}
}
return $content;
}
add_filter( 'the_content', 'InsertFeaturedImage' );
Before I added in the
else
{
get_the_image( array('size' => 'thumbnail', 'image_class' =>
'wp-post-image'));
}
It has worked fine. Now, it’s just displaying the small thumbnail there right in the top middle of post’s page. It should be displaying a full size image. So all this has brought me to the main two problems I’m now facing. 1) Can I edit that code in the functions.php file to still display the featured image in full size.
And 2) What if there is no Featured Image chosen for a post, can I also make the functions.php code display the first image of the post’s gallery, in full size?
I really hope this isn’t too confusing. Please see http://dependablecarcompany.com and see the post excerpt titled, “1991 GMC Sierra”. This post has no Featured Image, but a thumb is still being output, thanks to the Get The Image plugin. But when you actually click through to the actual post, you’ll see that the top, center image is showing the thumb. It should be the full size image.
Thank you so much for anyone who can get through all this, and share some tips for me!
Modify your function as such:
In the code,
'size' => 'full'
defines the image size to be shown. You can choose betweenthumbnail
,medium
,large
,full
, or any custom image size that your theme uses (none in your theme). The default isthumbnail
.UPDATE: Answer last edited based on comment.