You can just upload it as the featured image and then use something like get_the_post_thumbnail in order to actually retrieve the thumbnail version
http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
Hi there, JarretC:
thanks for the response. Unfortunately, that doesn’t seem to work.
My loop.php page already has:
<?php
if (has_post_thumbnail()) {
$thumbid = get_post_thumbnail_id();
$image_attr = wp_get_attachment_image_src($thumbid,$thumbnail_type,true);
$imgpath = $image_attr[0];
} else {
$imgpath = $padd_image_def;
}
?>
and then later where it is supposed to display the thumbnail, it has this code:
src="<?php echo $imgpath; ?>"
Yet it still shows the default thumbnail image (the one that is defined with:
else {
$imgpath = $padd_image_def;
}
Any other suggestions?
thanks in advance.
You can’t ‘define’ thumbnails as you were mentioning in your first post. The thumbnails are automatically generated from the featured image, there may be a plugin out there that does something similar to what you want but the default WordPress actions don’t work that way.
Ok, I am fine if I can use the default thumbnail But I don’t understand why the default is not working.
So what you are saying is to remove the:
if (function_exists(‘add_theme_support’)) {
add_theme_support(‘post-thumbnails’);
}
From the various functions.php file?
And if I do that, shouldn’t this code work then by simply setting an image as a “featured Image”?
~~~~~~~~
?php
if (has_post_thumbnail()) {
$thumbid = get_post_thumbnail_id();
$image_attr = wp_get_attachment_image_src($thumbid,$thumbnail_type,true);
$imgpath = $image_attr[0];
} else {
$imgpath = $padd_image_def;
}
?>
~~~~~~~~
Is it possible it doesn’t work because no arguments are being sent in:
$thumbid = get_post_thumbnail_id();
It says in the codex that arguments are optional though, so I don’t know why it wouldn’t work if a post has
Thanks in advance for any suggestions. I really need to get this working. I like the theme, but it isn’t supported so I would hate to have to give up on it now.
Aha… I understand.
I was trying to use an image that I was hotlinking to as the featured image. But you can’t do that for a thumbnail.
I guess you have to use an image that you actually upload. If you instead give it the address of an image that already exists on the web somewhere, it won’t actually upload and crop the image.
Oh well… it only took me all day to figure it out 🙂
hehe that does make a difference 😉
You could use some custom code that would do something like that but not a native WP function 🙂
Thanks Jarret:
Really it is fine the default way. I just wish there had been some sort of popup or note or something saying that hotlinked images can’t be used for thumbnails.