Post from any Category with Thumbnail Image at WordPress Sidebar
Featured Category with Thumbnail Images in the Sidebar – WordPress
Well I an NOT really writing a solution to add “Posts with Thumbnails from particular categories” to the sidebar of your wordpress blog. I am trying to find the solution and asking for help really. I am sure it can be done. As I can do it with the discontinued wordpress theme OPTIONS. I am still using “Options” theme in many of my websites and will continue to use till I find a solution.
Easy Solution: Keep using OPTIONS theme! They have removed download however. If you have a copy, keep using the theme. Domo at my Music Site
Lets see how the OPTIONS theme does it. First of all, it comes with some DEFAULT WIDGETS. Unfortunately you can not use those widgets with other themes.
Here is the widget I am talking about -
You can see this widget ONLY if you have the options theme installed. Now check the options that the widget offers -
So, you can see that the Default OPTIONS theme comes with this wonderful addition. Now lets see if we can do it for other themes.
Partial Solution:
Partial solution of the issue of adding posts from particular categories in your wordpress sidebar can be resolved using the great plugin “Catogory Post Widget” by James Lao. With this wonderful plugin you can configure and manage -
- Specify how many posts to show
- Set which category the posts should come form
- Designate how many of the widgets you need
- Specify whether to make to the widget title a link to the category page
- Optionally show the post excerpt
The options on the widget looks very similar to the default widget that comes with the Options theme. Check and compare the images of this widget with the previous images. Lets see the widget little bit closer -
And here are the widget options:
If you pay some attention, you will see that this widget is great except we do not any option to add thumbnails.
Now some users are claiming modification of the “Category Post Widget” can insert thumbnails. I found two such claims. But none worked for me. I am not great applying php code modifications. But here they are. Both requires edit in line 55 of cat-posts.php file. This is the original code for the widget. You can go to the “plugins” folder to get the file from server if you like.
Solution 1: Edit the code at line 55 as below:
============================================================================
echo '<li class="cat-posts-item-' . $post->ID . '">' . '<img align="left" class="thumbnail_cat_posts" src="' . get_post_meta($post->ID, 'post_thumbnail', true) . '"><a href="' . get_permalink($post) . '">' . $post->post_title . '</a>';
=======================================================================
Solution 2: Edit the code at line 55 as below:
=========================================================================
//Category with thumbnail $post_thumbnail = get_post_meta($post->ID, "post_thumbnail", true); if ($post_thumbnail != "") { echo '<li class="cat-posts-item-' . $post->ID . '">' . '<img class="thumbnail_cat_posts" src="' . get_post_meta($post->ID, 'post_thumbnail', true) . '"><br /><a href="' . get_permalink($post) . '">' . $post->post_title . '</a>'; } else { echo '<li class="cat-posts-item-' . $post->ID . '"><a href="' . get_permalink($post) . '">' . $post->post_title . '</a>'; } //End category with thumbnail ================================================
Reference: http://wordpress.org/support/topic/235279
Please let me know if the modification of the code really worked for you. I have spend a HUGE amount of time trying to find a solution. It would be really nice to know how to do it.
Please also visit the wordpress forum post :http://wordpress.org/support/topic/140448 , Here people are discussing whether the Category-Post widget can be used with Thumnails.


Hello,
The first sollution is great. All you have to do is to add a custom field named “post_thumb” to each post of your blog.
And if you want too customise the size of your image near title, add the following code:
echo ‘ID . ‘”> ‘ . ‘ID, ‘post_thumb’, true) . ‘”> ‘ . $post->post_title . ‘‘;
Great Info for AMO.
THANKS,
Very well written post however, I would recommend that you turn the No Follow off in your comment section.
Keep up the good work.