All entries for Tuesday 07 December 2010
December 07, 2010
Thumbnails in Wordpress 2.9+ and 3.0+
Now that Wordpress added a thumbnail feature (2.9+), we longer need to assign custom fields and give them values each time we write a blog post. Insted, while writing a blog post, there is a small panel or block to the side that allows us to choose a thumbnail for the post.
However, for people like me, who have been using custom fields to show pictures for sometime, there is a decision to be made. Should we stick to the custom fields and just continuou using them or should we start using the core thumbnails featre instead?
Well, you don't really have to the choose one of these two, you will keep using them both. How you ask? Well, simply, stop using custom fields for any new posts you write and use the thumbnail feature to assign thumbnails to blog posts. Then, edit your templates and add some simple conditions so that Wordpress checks whenever a blog post is viewed if it has a custom field thumbnail or a core wordpress 2.9+ thumbnail. By doing this, your old blog posts thumbnails will still show and your new thumbnails, the one you assign using the new feature will also show.
Honestly, I was very worried about having to choose one of these two, and since I am not a programmer/developer/coder, I was worried that I wouldn't be able to figure this out. However, with some thinking and imagination and with the help of a number of great Wordpress articles I was able to use my thumbnails in my Blog homepage. Not only that, but using some of the new features related to thumbnails, I was actually able to set specific sizes for the different pages in my blog. For example, on my homepage, all posts thumbnails are 100px x 75px. However, when a visitor clicks on a certain blog post to view it, he is shown the same picture but in a different size, say 200px x75px. This is really nice and it's really simple to achieve.
As I said, I am not a programmer and I was able to figure this out with the help of the following resources. There is no reason why you shouldn't be able to get similar results :). I would also like to thank each one of those blog authors:
- Bulletproof Post Thumbnails in WordPress 2.9
- WordPress 2.9 : Display post image with backward compatibility
- Using The New Post Thumbnail Feature In WordPress 2.9
- The Ultimative Guide For the_post_thumbnail In WordPress 2.9
- New in WordPress 2.9: Post Thumbnail Images
- Everything you need to know about WordPress 2.9′s post image feature
If anyone (not good with coding as I am) wants to look at the code I have used in my template pages to show the thumbnails, I would be happy to share.
If you want to check what I was talking about, you can visit my Arabic Research Blog. Don't ming the language, but make note of the thumbnails then follow some of them to the post view page to see if the thumbnail's dimension will change or not. Please note that because some of the thumbnails are actually cropped, they might not show in a bigger size if you follow them to the post.