TW Recent Posts Widget

TW Recent Posts Widget is advanced version of the WordPress Recent Posts widget allowing increased customization to display recent posts from category you define.


  1. Unzip the downloaded tw-recent-posts-widget zip file
  2. Upload the tw-recent-posts-widget folder and its contents into the wp-content/plugins/ directory of your WordPress installation
  3. Activate TW Recent Posts Widget from Plugins page


  1. Go to the Appearance / Widgets tab and make new instance of this widget as many time as you wish.


  1. If you need to configure the CSS style of TW Recent Posts Widget, you can edit the tw-recent-posts-widget.css file from the plugin directory.


This plugin is free! Click here to download tw-recent-posts-widget plugin.


  • Thumbnail image is not displayed in widget output.
    An image MUST be set as featured image in each post you want to show in widget output.
  • Thumbnails show up larger than the options set.
    Images are displayed with WordPress function the_post_thumbnail() and image size is based on your Media Settings under WordPress Settings.
    Also, if you are creating custom thumbnail in your theme with WordPress function add_image_size() that dimension will be useful too.
    For example, if you set image width and height in your widget instance to some value that is not proportional to your custom images size, that dimension will not be output properly
  • I want to show different post excerpt in widget than it is set in post content.
    Post excerpt is generated from post_content data. Plugin truncate first X characters from this field.
    If you want to show different content, than you should type that content to post_excerpt field. When post excerpt is set, plugin will truncate X characters from post_excerpt field instead of post_content field.

93 Responses to TW Recent Posts Widget

  1. Branis says:

    Thank you for this excellent plugin. I find it extremely useful and very easy to setup.

  2. Chris says:

    Great plugin! One thing I’d like to see is the ability to choose *all* categories instead of just one.

    • Igor says:

      Thanks Chris.

      The original idea was to promote posts from one category.
      I was thinking to add multiple select box instead of single select, but not sure that it will be more useful than this. Maybe option all can be added to select box as well.

      But as I said, I am thinking about it. Will decide if others request that from me too. 🙂

  3. Riccardo says:

    Hi Igor,
    I have a problem with this plugin because it does not show the thumb of the post. How it is possible?
    Thank you very much

    • Igor says:

      Hi Riccardo,

      You should set image as featured image if you want to show it in widget.
      Did you set it in your posts?

  4. Elias Vega says:

    Hi Igor, Thanks for this plugin!! Your answer about “display the thumb” really helped me!

  5. Antonio says:

    Perfect for my blog, do you have any feature plans to sort popular posts by views ?

    • Igor says:

      Hi Antonio,

      Thanks for your comment.
      Posts are queried with WP_Query Class, so all options for orderby are from this Class.
      As you can see on this URL there is no option to sort posts by its popularity except to sort them by comment count. Maybe that option can be useful for you?

  6. George says:

    Hi Igor,
    first of all thanks for the plugin.

    i recently used your plugin for website where is non ASCII language like hebrew and there was a problem with the excerpt length so i fixed it by changing the substr function to mb_substr and it works like it should.

    maybe it’s a good idea to update it in your plugin.

  7. yeshong says:

    I like this plug-in! Thank you!

  8. Thank you for the nice plug in. I wonder if you plan to add a date featured, after the the title. Just wondering sa some customers ask me for the option.

    Great Job….

    • Igor says:

      Hi Jorge,

      Thanks for you comment.
      I was thinking about that option when I was writing this plugin for a first time, but I did not add this option.
      Because many of you are suggesting new features, I will add all of them to the new version of plugin.

  9. Maja says:

    My brother! 🙂
    Well done! :*

  10. fred says:

    Hi Igor,
    This is a great plugin. Thank you! I do have one issue and wanted to see if you can resolve it. When I select show excerpt, the excerpt always starts with the word ‘Tweet’ then continues with the actual excerpt. I am currently using “Social Sharing Toolkit” which has the social icons on top of my posts. I am assuming this is where the excerpt is grabbing the word ‘Tweet’. Are you aware of any fixes for this?

  11. Jake says:

    Hi Igor, great plugin very very helpful !!!
    One issue I have when using it as a sidebar widget I get a large gap under the widget before the next one begins ?
    Only seems to happen with this widget

    • Igor says:

      Hi Jake,

      Thanks for your comment.
      Plugin is adding class with name featured-posts to the widget output.
      In your WordPress theme’s stylesheet (style.css) on the line no. 1513 you have style defined for that class and you set height property for that item to 328px.
      If you change that, everything will be perfect. 🙂
      If you have an item with that class on your website than change style by adding name of parent. For example:
      .featured-posts change to #content .featured-posts in your css file on the line no. 1513 if that item has item with name content as parent.


  12. Chris says:

    Hi there,

    Looks like a great plugin and exactly what I’m after, except…

    I’ve followed the advice in the above instructions, have read the comments above, and nope – I just can’t get the thumbs to show up. I’ve removed the gallery, I’ve deleted and added individual photos to the page several times. Probably something in my theme (Photocrati) is overriding it.

    Any suggestions?


    • Igor says:


      Can you add the following line of code to your functions.php file in your theme?

      • Chris says:

        That returns a syntax error, pulls the whole page down. Can you double check it please?

        • Igor says:

          You should add code without < ?php ?>
          Also, you must add this code to function that runs after theme setup.
          For example:

          So, if you have some function that is run via add_action() and has first argument 'after_setup_theme' add add_theme_support ( 'post-thumbnails' ); inside of that function.
          If not, create new function as I described above.

  13. Paolo says:

    Hello, congratulations for the plugin for wordpress, very useful but, with my immence displeasure, my template does not work because my template does not include the featured image!!! I would be very happy if there is a solution.
    Thank You
    Paolo Windspirit

    • Igor says:


      Please see comment above.
      Try to add the following code in your functions.php file.


  14. Paolo says:

    No documentation available for add_theme_support()  !!!!!!

    • Igor says:

      How do you mean, “no documentation”?
      On this URL, for example, you have it:

      Images are displayed via the_post_thumbnail(); WordPress function, and to do that your WordPress and theme must support post-thumbnails feature.
      Because of that, you must add add_theme_support( 'post-thumbnails' ); to your functions.php file (in case you do not have this added).

  15. Dave says:


    Excellent plugin – just one question, is it possible to stop the plugin removing html tags.  I am trying to display some testimonials and I want the testimonial to show and then display the authors name:

    (line Break)

    I am using a plugin called Advanced Excerpt and this leaves html tags in excerpts (which are showing in normal category/archive views) but your plugin will not show the line break.

    Any help would be appreciated.



    • Igor says:


      To do that, you must change my plugin.
      I can show you what to do.
      Open tw-recent-posts-widget.php file and change code on line 151 (if you are using the latest version of plugin – 1.0.3).

      Instead of $this->truncate_post($length) you should write $this->truncate_post($length,false,'<p><br>')
      As you can see, as a third argument you should add all HTML tags you want not to be escaped!
      More info about tags you may use, you can find on this URL:

      If you do this and if you upgrade my plugin later, you should change this line again, because update will overwrite it!


  16. Paolo says:

    if I insert the code, the entire portal is not visible!
    I just tried but nothing, as post-thumbnails is used by portfolio-post.

    • Igor says:

      I hope that you inserted it on the right place and without < ?php ?> in case you had them already opened? 🙂
      If you want, you may send to me your functions.php file and I will put code where it should be.

  17. I LOVE this plugin. It works great on all my sites except for two. These two are older themes (about 2-3 years) and I am unable to resize the images in any way. This is an issue with my theme, I’m sure.

    Would you be able to recommend a work-around for this? I have changed the settings in Media in Settings in Admin – nothing. I have adjusted the settings in the plugin – nothing. I also noticed that my system settings for thumbnails did not change, either. [Hint]

    Thanks for the fabulous work!

    • Igor says:


      You did not say what was the problem with websites where this plugin did not work.

      Anyhow, if you change media settings – that settings will be applied on the images you upload later. To apply settings on images you already have, you should use some plugin that will regenerate your thumbnails!

      There is a lot of comments here, so maybe some of them will solve your problem.


  18. Paul says:

    Hello, such a great plugin! Just a quick question, can i somehow call this plugin with php in page edit and not

    with widget? I hope that u will understand what i mean. Cheers!



    • Igor says:


      Unfortunately, it is not possible to do that with this plugin.
      As it’s name said, this is TW Recent Posts Widget 🙂

      • Paul says:

        Never mind then, i just wanted to ask if there is a way to do that :-). Anyway thanks for quick reply and keep up awesome work!



  19. Tom says:

    Hi Igor,

    Great widget, thanks! I was wondering if you could advise on how I might set the widget to show only one thumbnail image. I would ideally just show the thumbnail related to just the most recent post.


    Thanks so much

    • Igor says:


      To do that, just check ‘Show post thumb’ and define image size.
      Do not check others items, like are ‘Show post title’, ‘Show post excerpt’, etc.


  20. Cailin says:

    Hi Igor,

    This is a great widget! I was wondering though, is it possible to ignore “sticky” posts in the feed of articles in the widget? No matter which option I pick i.e. descending or ascending order, the sticky post remains at the top of the list. On my website, the sticky post is the featured post. I’d really like to have all but the featured post show up in the widget. And ideas of something I could add, a piece of code maybe, that would ignore the sticky posts, but keep the rest? Thank you so much! I really appreciate it!


    • Igor says:


      Thanks for your comment.
      To do this, you must change my plugin.
      Open tw-recent-posts-widget.php file and change code on line 130.
      Add the following in array() – ‘post__not_in’ => get_option( ‘sticky_posts’ )

      So, instead of



  21. jsherk says:

    This is a great plugin. Thanks for providing it.

    I have three feature requests:

    (1) Would like the option to include and/or exclude certain categories as opposed to the option of only 1 category or all category.

    (2) Would like to be able to move the date to the left side of the text instead of the right side.

    (3) Would like to be able to change the text size and make it smaller.


  22. Igor says:


    Thanks for your comment.
    (1) That feature is not available in current version. Maybe in some future version…
    (2) Create your own style to avoid default style.
    (3) The same as (2).


  23. semooz says:

    great plugin thanks

  24. BBCOM says:


    Thanks for this plugin.  It is what I wanted.

    Only one problem, I set the number of posts in the widget (5), but the plugin displays 25 posts.

    Where can I change this ?

    • Igor says:


      Are you sure that you did not change plugin’s code? I can see that widget output on your website is different than original.
      It is not possible that widget output more posts than you set.


  25. Mark says:

    Hello Igor,

    Best Featured Posts plug-in I have found. Many thanks.

    One question; I get a 1px grey line at the bottom of the last post in the side bar. Would that be

    coming from from the widget? I would like to remove it if possible. Any ideas?


    • Igor says:

      Hi Mark,

      Thanks for your comment. I appreciate it. 😉
      My plugin is creating output in div which has class featured-posts.
      Your theme twentyeleven in default css file on the line no: 1513 has style for that class and that is why you see this line.
      Change that and you will not have it anymore.


  26. BBCOM says:

    Thank’s for your answer.  I don’t remember having changed the code.
    Is this part of the code that is the problem?

    <p><label for=”<?php echo $this->get_field_id(‘count’); ?>”><?php _e(‘Number of posts to show:’, $this->localizationDomain); ?> <input

    id=”<?php echo $this->get_field_id(‘count’); ?>”
    name=”<?php echo $this->get_field_name(‘count’); ?>” type=”text”
    size=”3″ value=”<?php echo $count; ?>” /></label></p>

    I don’t know how to solve this problem.

  27. Remdog says:

    Plugin is nice!! Just what i am looking for. Unfortunately I can’t seem to get my thumbnails to resize.

    I have:

    A) Added the images as Featured Images;

    B) Used Thumbnail Regeneration plugin;

    C) Tried clearing out my own cache;

    Any ideas what I can do. The theme I am using is Responsive.

    Thanks for your time!!

  28. Remdog says:

    YES!!!! I got it to work. OK nevermind. I am not sure why it didn’t work the first time but it’s working now.

    So my last question. I want the thumbnail to be to the left of the Title not just left of the excerpt. How can I format that?

    Thank you!

    • Igor says:


      Plugin outputs content in order as I defined.
      There is css style which defines properties for each element, and you may change style here or create your own.

      If you want to change order of elements, as you said, than you must change PHP code in plugin, but this is not good solution if you want to upgrade plugin later.


  29. David Vogel says:

    The thumbnail feature works like a dream on one of my sites, but not on another site I’m developing.

    I’m setting all the settings in the widget exactly the same as far, but it’s as if the thumbnail size is being completely ignored and the image is displayed full size. Any idea of places I should look to fix this? Email me and I can give you more details if need them. One of the sites is still under development so I’m not giving out the address right now.


  30. Kay Wong says:


    This is a great plugin. Easy to use and install.

    I have 2 questions.

    1) Is it possible to make the feature image in square? (such as 100×100 or 200×200)

    2) How to separate, for example, 10 recent posts into 2 columns? Like 5 posts in each columns?


  31. Jason says:

    Thanks for the great plugin! Can you please add the functionality to exclude a category? I really need it in order to use your plugin effectively on our site.

    • Igor says:


      Thanks for your comment.
      I will think about that suggestion, and on many others and will try to develop new version of plugin one day.


  32. Abe says:

    Seems to be working perfectly here. I’m developing a new template for my website and have tried several recent post widgets… This one has far more options 🙂

  33. Shiju Komath says:

    Hi friend ,

    I need to add this in my home page . So Could you please provide Short code for this plugin

    • Igor says:


      Unfortunately, there is no shortcode for this.
      This plugin works only as widget, as it’s name says. 🙂


  34. Penny says:

    My site is:

    I am having trouble with the image sizes in your plug-in with my template (Pinboard). The images are displaying huge, as you can see in the footer of my home page. I have a featured image set in every post. I put 75×75 in plugin. I went to media settings and set thumbnails at 75×75. I used a thumbnail regenerator. And still, the images are huge.

    I saw in one of the comments above, to add the theme support code to functions.php. However, I already have that in my theme but it is defined greatly after I think. Below is that portion of my functions.php file. Can you tell me what to change to make the plugin tumbnails display the proper size. I do NOT know code so please give me specific changes. Thank you!

    // Add support for post thumbnails and custom image sizes specific to theme locations
    add_theme_support( ‘post-thumbnails’ );
    add_image_size( ‘slider-thumb’, 1140, 395, 1 );
    add_image_size( ‘blog-thumb’, 700, ( pinboard_get_option( ‘crop_thumbnails’ ) ? 300 : 9999 ), ( pinboard_get_option( ‘crop_thumbnails’ ) ? 1 : 0 ) );
    add_image_size( ‘teaser-thumb’, 332, ( pinboard_get_option( ‘crop_thumbnails’ ) ? 205 : 9999 ), ( pinboard_get_option( ‘crop_thumbnails’ ) ? 1 : 0 ) );
    add_image_size( ‘gallery-1-thumb’, 432, 432, 1 );
    add_image_size( ‘gallery-2-thumb’, 268, 268, 1 );
    add_image_size( ‘gallery-3-thumb’, 268, 164, 1 );
    add_image_size( ‘image-thumb’, 700, 9999 );
    add_image_size( ‘video-thumb’, 700, 393, 1 );

    • Igor says:


      As I can see these images are 75x75px.
      You have in you CSS style on the line #1317 the following style:

      .wp-post-image {
      display: block;
      width: 100%;

      Because of this, your images are scaled to fit whole widget width.
      Remove this width: 100%; from your style, and your images will be displayed as you define.


      • Penny says:

        Thank you so much Igor! I kept installing different plugins and always with the same result. After reading your page on your plugin, I knew it was somewhere in my theme. It works perfectly now — thanks again!

  35. Gio says:

    Hi, your plugin is compatible with wordpress 3.6.1? Thanks

  36. Yunie says:

    Thank you for your awesome plugin. Just what I was looking for! 🙂

    One thing I’m trying to do is have the “more” link only show if the post has been truncated. i.e. if I have posts truncated at 100 characters, I only want to display the show more link if the post exceeds this limit. If the post is under 100 characters, I don’t want to show this link.

    I had a look at the code, and think I might need to adjust this area:

    But I only know very basic PHP and everything I tried didn’t make a difference, the link still showed on a post with less than 100 characters.

    Thanking you! If it can’t be done, that is okay, but thought it won’t hurt to ask. 🙂

  37. Mark says:

    Hello, love the plugin.

    One question; I would like my list of Recent Posts to re-sort in a new random order on each page refresh. If I manually save the widget settings this random resort happens now.  So is there code that can be added to accomplish this automatically on page refresh?

    Also, I would like to add to previous requests to be able to select more than one post options for the display criteria.

    Many thanks!

  38. Mark says:

    Hello again, Is it possible to control the Excerpt by character count rather than word count? With a full word ending of course.



  39. Roy Rovers says:


    A small question which I just can’t figure out.

    On my homepage you’ll see a pin just above the blog tittles. How can I remove these?

    I looked at the css-files, the images, etc. But it just doesn’t seem to disappear.


    Hope you can help. Thank you in advance!



  40. javi says:


    Your plugin is REALLY usefull 🙂

    But i cant figure out which CSS is controlling the output, because the original from the plugin doesn’t show any changes made in it! :/

  41. Gontran says:

    Hi. Your plugin is great and I really appreciate it. However, is it possible to add pagination? Let me know if this is possible.

    Regards ! 🙂

  42. Shaan says:

    Hi Igor,

    I like this widget a lot! Only question I have is whether it is possible to grab thumbnails from a URL rather than the featured image? I am trying to minimize the amount of content I host on my own server, so I have installed this plugin to set featured images via URL. Would be great if I could somehow get your widget to pull from the same URL.

  43. Hi, I am trying to change the size of the thumbnails but cannot change them.  I have installed Regenerate Thumbnails and looked for the code that makes the thumbnail width 100% but cannot find it.

    Its an excellent widget and would like to continue using it but do you know why I cannot change the thumbnail size ?

    Many thanks


  44. luigi cerulo says:

    it is possible to have a different layout for the home page widget? For example an horizontal list instead of a vertical one?

  45. matt says:


    Thanks for your great plugin. I have one request that would solve a problem I have with it… can you make the title of the widget linkable to the category it is showing? Or is there a way to specify that the widget title links?



  46. Jesse Miksic says:

    Great work on this.

    Just had one small issue: I have the plugin “default-sort-ascending” that puts the earliest posts at the top of my blog. I see your widget has a similar option. The problem is, when I have “default-sort-ascending” plugin activated, the “Recent Posts” list starts with the very earliest posts, and only shows the first X posts (i.e. however many I set). So the most recent posts aren’t shown.

    I can half-fix this problem by setting your widget to “DESC,” which shows the most recent posts correctly, but orders them with the most recent at the top of the widget. I’d like to find a solution where the latest posts are shown (up to X posts, i.e. 5 or 6 most recent), and they’re displayed in ascending order, so the most recent ones are at the bottom. (this is how the WordPress site, linked above, is currently set)

    I know this might be largely a problem with the “default-sort-ascending” plugin, but I was wondering if you might have any insight into it. The author of that plugin doesn’t seem available for support.

    Thanks, and again, great work.

  47. Hi! Would you mind if I share your blog with my zynga group?
    There’s a lot of folks that I think would really enjoy your content.
    Please let me know. Many thanks

  48. Marc says:

    Hey Igor! Great Work! Great Plugin!
    I have one strange problem. Some text formatting in my posts are totally ignored from the plugin 🙁

    bold words are shown not bold. line-makeups are not the way i did them.

    Is there a way to tell the plugin, to use my text formatting?



    • Igor says:

      Hi Marc,

      Plugin will use all settings defined in any CSS file for classes it uses.
      For some reason styles may be overwritten from some other CSS where the same class is defined.
      Use !important in your style to make some style.


  49. JD says:

    Is there a way to put this on the actual page instead of just in the header, footer, etc?

  50. Denis says:

    Hello Igor,


    Thanks for the great plugin. Really appriciate all your work.


    Could you please let me know if there any chance to make a thumbnail with the size of 286×119 px

    as on — ?


    When I set this size — 286×119 px — in the result a thumbnail is shown with the size of 205×120 px instead of the size that I set in widget.





    • Igor says:

      Hi Denis,

      This is something that I wrote about for a dozen of time.
      Please read previous comments and find answer on your question.


  51. Lizzy says:

    Fantastic plugin. Thanks!

    I do have a question. Is it possible to format how the date is written? Currently, my blog shows dates like “November 19, 2014”, but I want to change only this widget so it says something like “11.19.14”. Is this possible without changing my entire blog’s setting?

    • Igor says:


      Current logic depends on WP date/time settings.
      Maybe some future version will support that.


  52. David says:


    I ´ve a problem with the plugin:

    If I write somthing and on the front page should just show the exerpt it messes up the hole stucture of my page (the exerpt moves to the bottem of the page) if the exerpt is to long..

    Is there a posibility to write the exerpt in to lines and not in onle long line?


  53. Christine says:

    I just updated your plugin, (apr 6, 2015) but now the “show excerpt” on the widget does not work.  I only get the Read More.

    Are you planning to fix this?



Leave a Reply

Your email address will not be published. Required fields are marked *