— Patrick Galbraith

Recent Posts Plus (WordPress Widget)

An advanced version of the WordPress Recent Posts widget, allows display of thumbnails, post excerpt, author, comment count, and more. Provides options to trim the title and override the post order and type. Also includes a simple template parser so you can override the default output.

Download: http://wordpress.org/extend/plugins/recent-posts-plus

 

1: Title

Default: Recent Posts

This field sets the title of the widget. It works the same as every other widget.

2: Number of posts

Default: 5

Changes how many posts are displayed in the widget. Enter '-1' to display all posts.

3: Include post thumbnail

Default: no

Displays the post thumbnails of each post.

If this option is hidden you may not have a theme with post-thumbnails enabled. You can manually enable and add post-thumbnails to each post or you can download the Default Thumbnail Plus plugin automatically display a default image.

4: Include post excerpt

Default: no

Displays the post excerpt of each post.

5: Show expert options

Default: no

Show/hide the expert options panel. These options should be used with more care.

6: Limit post title

Default: (no limit)

Limits the numbers of characters or words to display of each posts title.
Example: For the post title "Look at this title" setting this option to 7 chars would result in "Look at..."

7: Limit post excerpt

Default: (no limit)

Limits the numbers of characters or words to display of each posts excerpt.

8: Limit ellipsis

Default: ...

Sets the string to append to post titles or excerpts that have been shortened.

9: Post date format

Default: M j

Sets the PHP date format to use when displaying the post date.
See http://php.net/manual/en/function.date.php for overview of the options available.

Note: the date format can be overriden in the output template, which allows for multiple date formats in one entry, see section "12: Widget output template".

10: Thumbnail size

Default: 50 x 50

Sets the size of the post thumbnail in pixels.

11: WP_Query options

This is an advanced option that modifies what posts are shown in the widget. This option specifies extra arguments to use in the WP_Query request and as such is very flexible even allowing this widget to show pages rather than posts, show oldest posts first, or filter posts by tag or category. The WP_Query options must be specified in valid JSON format (validate here http://jsonlint.com/).

These are the default args that are sent to WP_Query:

{
"post_type": "post",
"posts_per_page": <same as Number of posts setting>,
"orderby": "date",
"order": "DESC"
}

 

List of options:

{
"post_type": "post", //post, page, revision, attachment, any
"post_status": "publish", //publish, pending, draft, auto-draft, future, private, inherit, trash, any.
"posts_per_page": "5", //overrides number of posts setting
"offset": "3", //number of posts to skip over
"post__in": [2, 3, 4], //only show posts 2, 3 and 4
"post__not_in": [2, 3, 4], //exclude posts 2, 3 and 4
"ignore_sticky_posts": "1", //ignore sticky posts or not. Default value is 0, don't ignore (requires WordPress 3.1+).
"caller_get_posts": "1", //ignore sticky posts or not. Deprecated as of Version 3.1 in favor of 'ignore_sticky_posts'.
"author": "1", //author ID
"author_name": "john", //post author's name, use 'user_nicename' (NOT name)
"orderby": "date", //none, ID, author, title, date, modified, parent, rand, comment_count, meta_value, meta_value_num
"order": "DESC", //ASC or DESC
"tag": "cooking,baking", //display posts that have "either" of these tags
"tag": "bread+baking+recipe", //display posts that have "all" of these tags
"tag_id": "13",
"cat": "1, 2, -3", //category ID 1, 2 but not 3
"category_name": "articles,news",
"year": "2011",
"meta_query" : [] //see below
}

 
For a full listing see http://codex.wordpress.org/Class_Reference/WP_Query

Ordering by custom fields

You can change the sort order to be based on a specified custom field using meta_value and meta_value_num as the orderby option.

Note: The difference between meta_value and meta_value_num is that the meta_value_num is sorted as a numeric value (i.e. meta_value would be ordered as a string e.g. 1, 3, 34, 4, 56, 6 whereas meta_value_num would be 1, 3, 4, 6, 34, 56).

The following example would order posts by custom field rating showing in order of highest rated to lowest rated.

{
     "meta_key" => "rating",
     "order": "DESC",
     "orderby": "meta_value_num"
}

 

Utilizing the meta_query option

Note: This option requires WordPress 3.1+

Filter or show posts with a certain custom field value using the meta_query option.

The following example would display posts with a custom field called mood with a value of happy:

{
    "meta_query": [
        {
           "key": "mood", //Custom field key
           "value": "happy", //Custom field value
           "type": "CHAR", //Custom field type. Possible values are 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'
           "compare": "=" //Operator to test. Possible values are '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'
        }
    ]
}

 
The following example would display posts if they have a custom field rating of between 5 and 10 or if they have a custom field mood with a value of happy:

{
    "meta_query": {
        "relation": "OR", //Possible values are 'AND', 'OR'
        "0": {
            "key": "rating",
            "value": [5, 10],
            "type": "NUMERIC",
            "compare": "BETWEEN"
        },
        "1": {
            "key": "mood",
            "value": "happy",
            "type": "CHAR",
            "compare": "="
        }
    }
}

 

12: Widget output template

This is an advanced option that modifies the output of the widget. You can modify the output with template tags and add custom classes or tags for styling.

By default the widget outputs posts in this format:

<li>
{THUMBNAIL}
<a title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a>
{EXCERPT}
</li>

 
You can modify the output by including the following template tags:

{ID} The post ID
{THUMBNAIL} The post thumbnail IMG tag if it exists, otherwise nothing
{TITLE_RAW} The post title
{TITLE} The post title, will be trimmed if it exceeds "Option 6: Limit post title chars"
{EXCERPT_RAW} The post excerpt
{EXCERPT} The post excerpt, will be trimmed if it exceeds "Option 7: Limit post excerpt chars"
{PERMALINK} The post permalink url
{DATE} The post date, the format is defined by the "Option 9: Post date format" setting
{DATE[php_date_format]} As of 1.0.4: Customized date format which overrides the default date format setting. E.g. {DATE[l jS F Y]} would display like "Monday 1st January 2011"
{AUTHOR} The post author name
{AUTHOR_LINK} The post author website url
{AUTHOR_AVATAR} As of 1.0.7: Displays the author's avatar if available
{COMMENT_COUNT} The total number of comments, Trackbacks, and Pingbacks for the post
{META[name]} As of 1.0.5: Displays the value of the specified custom field. E.g. {META[Currently Reading]} or {META[Rating]}. Note: Only returns the first result.
{ELLIPSIS}...{/ELLIPSIS} As of 1.0.9: Overrides option "8: limit ellipsis" for the excerpt.
                         You can use other templates tags within the {ELLIPSIS} tags but not PHP and it will only be appended to the excerpt if it is truncated.
                         Example: {ELLIPSIS}... <a href="{PERMALINK}">(more)</a>{/ELLIPSIS}

 

Using raw PHP in the Widget output template

As of 1.0.7 you can add raw PHP code to the widget output template.

Note: This will require the PHP code you enter to be run though eval which will likely have a small performance penalty. However if you don't enter any PHP code eval will not be run. Be careful not to give untrusted users permission to modify widget settings since it could be a potential security risk.

The following example displays the author's avatar at 32px size:

<li>
<?php echo get_avatar(get_the_author_meta('user_email'), 32); ?>
<a title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a>
{EXCERPT}
</li>

 
You can access some of the existing template tag values with the $widget_ouput_template_params array e.g. $widget_ouput_template_params['{ID}'] contains the current posts ID.

 

Examples of Styling the Output

The look of the widget output depends a lot on what theme you are using. By default the output looks somewhat like the image below. Thankfully we can improve this with very little effort and a few additions to your themes stylesheet.

The first thing you need to do is go to Appearance -> Editor and select the Stylesheet option on the right (it should be selected by default but just make sure). After that paste one of the following styles at the bottom of the stylesheet depending on the look you want.

Note these are just basic examples you can do a lot more with more with CSS. These examples also depend a lot on the theme you are using, more complex themes may require additional styling. Hopefully these examples can point you in the right direction.

.widget_recent_entries li {
    clear: both;
    margin: 5px 0;
}
.widget_recent_entries .wp-post-image {
    vertical-align: text-top;
    margin: 0 5px 0 0;
}

 

.widget_recent_entries li {
    clear: both;
    margin: 15px 0;
}

.widget_recent_entries .wp-post-image {
    float: left;
    margin: 0 5px 0 0;
}

.widget_recent_entries li p {
    margin-top: 5px;
    color: #707070;
}

 

.widget_recent_entries li {
    clear:both;
    margin: 5px 0;
}

.widget_recent_entries .wp-post-image {
    vertical-align: middle;
    margin: 0 5px 0 0;
}

 
The above example has the thumbnail size set to 25px x 25px.

.widget_recent_entries li {
    clear:both;
    margin: 10px 0;
    text-align: center;
}

.widget_recent_entries .wp-post-image {
    margin: 0 5px 0 0;
}

.widget_recent_entries li a {
    display: block;
}

 
The above example has the thumbnail size set to 100px x 100px.

Related Posts

137 comments
  1. CJ says: August 16, 20118:28 am

    Hi,

    I went through and added a second date field so you can separate formats, like month on top and day on bottom. Like http://yourwebsiteforless.com/mysite2/ in right sidebar.

    I can send it over if you want it.

    Thanks,

    • patrick says: August 16, 201110:04 am

      Hi CJ that would be great if you can send it through I will incorporate it into the next update.
      Also that way you won't have to hack every revision. Let me know if there are any other fields you might need.

  2. patrick says: August 16, 201111:49 am

    Hi CJ I just updated the plugin to v1.0.4 and added a custom date format feature. This should be more flexible than just adding extra date format fields as it allows for any number of custom date formats.
     
    How it works is specifying {DATE} in the template will display with the date format defined in section 9 "Post date format". However you can override this by using {DATE[php_date_format]} and specify your own custom format.
     
    So you could do {DATE[M]} to display "Aug" and {DATE[d]} to display "15" which is the day of the month.

  3. CJ says: August 17, 20114:06 am

    Awesome, that works better then what I did. The only other field I am having to create is a read more link. Awesome plugin by the way. I have been looking for something like this as I have a client that continually uses a similar format to what is in that site, and I was having to write it out by hand each time so I was about to create a plugin for it but you saved me lots of time :) . Thanks a bunch.

    Do you accept donations?

    • Patrick says: August 17, 201110:59 am

      You should be able to create the read more link with the existing options.
       
      Like this:
      <li>
      {THUMBNAIL}
      <a title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a>
      {EXCERPT} <a href="{PERMALINK}">Read more</a>
      </li>

    • Patrick says: August 17, 201111:49 am

      Actually looking at your site I would suggest something like this:
       
      <li class="news">
        <div class="inthenews">{DATE[M]}<span class="date">{DATE[d]}</span></div>
        <div class="news-content"><a title="{TITLE_RAW}" href="{PERMALINK}"><strong>{TITLE}</strong></a>
          <p>{EXCERPT} <a href="{PERMALINK}">Read more</a></p>
        </div>
      </li>

       
      I think it makes more sense semantically to use <LI> rather than <DIV> as the container since you are representing a list of items (in this case posts).

  4. CJ says: August 19, 20113:13 am

    Awesome.. Thanks for your help!

  5. Michele says: August 23, 201112:45 am

    Thank you for such a great plugin. I want to thank you specifically for making it so easy to change the way the output displays. Instead of having to figure out what the names of the CSS styling are and where the heck the files are, you've included the code right within the settings. Yippee! Oh, how I wish every plugin did that!

  6. cnng says: August 23, 20119:41 am

    I would like to add a "Read More" text below the excerp. How can I do that? Please help.
    The website address is http://sevendwarfspreschool.ca/setup/

  7. Patrick says: August 23, 201110:26 am

    Hi Cnng,
     
    See my above comment you can do it by adding the code below to the Widget output template
     
    <a href="{PERMALINK}">Read more</a>
     
    Edit: Looks like you already figured it out and updated your site.

  8. Juancho says: August 25, 20114:06 pm

    Very good plugin! YEAH! Thanks!

  9. Carolyn Shearlock says: August 27, 20115:35 am

    I'm obviously not understanding how to edit the WR-Query options. If I have nothing in the box, EXACTLY what do I put so that the sticky posts are not shown?

    Thanks -- it's doing exactly what I want otherwise. I was able to customize the output as I wanted, just not the query.

    • Patrick says: August 27, 20118:44 am

      Hi Carolyn,
       
      To modify the WP-Query to remove sticky posts you enter this:
       
      {
      "ignore_sticky_posts": "1"
      }

       
      To make the thumbnail a link just do this:
       
      <a title="{TITLE_RAW}" href="{PERMALINK}">{THUMBNAIL}</a>
       
      I haven't had a chance to try it since I'm on my phone but it should work fine.

  10. Carolyn Shearlock says: August 27, 20117:30 am

    Sorry, one more question .. .

    What would the output code look like to make the thumbnail clickable? I feel like I should be able to figure it out on my own, but I'm not getting it.

    Thanks!

  11. Carolyn Shearlock says: August 27, 201111:24 am

    Patrick --

    Thanks for the really fast response. The clickable image works perfectly.

    The ignore sticky posts is still a problem. That's what I entered originally, and I copied and pasted your code. I still get the sticky. My theme is Atahualpa -- is that by any chance causing the problem? Is there another place to put the code, maybe in the plugin file?

    Thanks for helping, I really appreciate it!

    Carolyn

    • Patrick says: August 27, 20113:15 pm

      Strange I doubt it is the theme, try removing the quotes from the value like this:
       
      {
      "ignore_sticky_posts": 1
      }

       
      Here is the documentation for that option from the WordPress Codex, note it will still show the stickied post but it won't place them at the beginning. If you are looking to exclude those posts then use "post__not_in".
       

      "ignore_sticky_posts (bool) - ignore sticky posts or not. Default value is 0, don't ignore. Ignore/exclude sticky posts being included at the beginning of posts returned, but the sticky post will still be returned in the natural order of that list of posts returned."

       
      I'm away on business until Monday so I can't really test anything on my end until then.

  12. Carolyn Shearlock says: August 27, 20119:34 pm

    It's still showing at the beginning of the list (it was one of my first posts, not at all recent). No problem with waiting until you're back.

    Thanks for the help!

    C

    • Patrick says: August 27, 201110:40 pm

      I will figure out what the issue is when I get back.
      Just a little thing what version of WordPress are you running? The ignore_sticky_posts option was added in WordPress 3.1

  13. Carolyn Shearlock says: August 28, 201112:19 am

    That explains it. I'm on 3.0.1. Could I use the post_not_in to exclude it (it's the only Uncategorized post I have . . .)? If so, what would be the code?

    Second question . . . any chance you'd ever write a "matching" widget for random posts? I'd love to have one to highlight older content (most of mine is evergreen) but want it to have consistent styling with the recent posts.

    Thanks for figuring out the problem when you're off doing other stuff!

    • Patrick says: August 29, 201110:25 am

      The code prior to WordPress 3.1 to ignore sticky posts is:
       
      {
      "caller_get_posts": 1
      }

       
      To make it into a random posts widget just add:
      {
      "orderby": "rand",
      "caller_get_posts": 1
      }

  14. Carolyn Shearlock says: August 30, 201112:54 am

    Thanks so much! The caller_get_posts works perfectly.

    I'm going to have to work a little on the random posts as it's not formatting correctly (it may be that some of the older posts don't have the featured image and excerpt set, have to check . . )-- but that's going to be in a day or two as I'm working on a deadline for another project today and tomorrow.

    Thanks again and I'm sending a small donation!

  15. Stacie says: September 1, 20118:29 pm

    I am too new at all this and have never had anything to do with web design before. Anyway I have just set up my website and really like this pluggin however when i click to read onw of the recent posts the pluggin itself then shows a lot of coding in the sidebar (I apologise if i am being completely stupid) however i would greatly appreciate if someone could tell me how to fix this. Thanks so much

    • Patrick says: September 1, 20119:22 pm

      Hi Stacie,
      Sure I can help you that is no problem but I will need some more information.
      What version of WordPress are you running?
       
      Edit: Just saw the problem on your website (jsrcharteredaccountants.com). It seems to be an issue with your theme (zeeBusiness) I'm going to do some testing and will post back here when I figure out the issue.
       
      UPDATE: The issue is caused by a conflict with the Sharebar plugin. You can temporarily fix the issue by unchecking the "Include post excerpt" option.
      Basically the Sharebar plugin is adding code to the post excerpt but the tags are getting stripped so it is just showing the code in plain text. Due to limitations with the way WordPress handles post excerpts this could be a little tricky to fix on my end but I will have another look.

  16. Hal says: September 1, 201110:37 pm

    We can't get the "Expert Options" to work on our site. We're using WP 3.2.1 with the Genesis Theme Framework. Regardless of the query options we use, we get the same results, the most recent 5 posts. We want to display just one author's posts or just one category of posts. Here's the query code:
    {
    "cat": "35",
    "posts_per_page": ,
    "orderby": "date",
    "order": "DESC"
    }

    The category has exactly 4 posts in it. All are the most recent posts. When displaying it includes those posts plus the next most recent post in another category. When changing the category ID to a category with five entries we still get the most recent 5 entries and none of the older posts in the other category.

    The same holds for "author". We get the same 5 most recent posts as results including posts from different authors. Here's the page where we're using your plugin
    http://www.leanproject.com/who-we-are/people/hal-macomber/

    Any advice?

    Thanks,
    Hal

  17. Hal says: September 1, 201110:44 pm

    Weird, when I pasted the code above it didn't include the value for posts_per_page.
    Here's the correct query code
    {
    "cat": "35",
    "posts_per_page": ,
    "orderby": "date",
    "order": "DESC"
    }

    • Patrick says: September 1, 201111:24 pm

      Hi Hal,
      Try just this to set the category
      {
      "cat": "35"
      }

      and this to set the author:
      {
      "author": "1"
      }

      Or you can do both like this:
      {
      "author": "1",
      "cat": "35"
      }

      Also try posting your WP_Query code into http://jsonlint.com/ to make sure it is in valid JSON format, it looks like you have an invalid quote character.
       
      Then you can change the number of posts with option "2: Number of posts to show"

  18. Stacie says: September 2, 201112:36 am

    Thank you I appreciate your help on this (To be honest this is all totally new to me) My version is WordPress 3.2.1. Thank you again. I have unchecked that box but I had quite liked the 'preview' showing but at least this fixes it temporarily

    Regards Stacie

    • Patrick says: September 6, 201112:48 pm

      Hi Stacie please update to version 1.0.5 the conflict with Sharebar should be fixed now.

  19. Hal says: September 2, 20112:10 am

    Patrick, replacing the invalid quote character did the trick. Love the control your plugin provides! Thanks.

    Look for a donation!

  20. Jordan says: September 2, 20113:41 am

    Hey Patrick. Love this plugin and it's doing exactly what I need! On my homepage I have a widget that only displays one post at a time - my most recent. However I would also like to make past posts sticky so they go to the top and are a featured post from the past. However when I make an old post sticky the widget populates with two posts (even though I'm only telling it one), the sticky post on top and the most recent on the bottom.

    Is there any way I can have only one displayed at all times, even when using sticky posts? Any help would be much appreciated.

    • Patrick says: September 3, 201112:13 pm

      Hi Jordan,
      If I understand correctly you want to feature just one post from the past. I will have to test if there is an issue with the way WordPress handles sticky posts.
       
      But you could achieve what you want by adding this to the WP_Query setting where 7 is the post id that you want to feature.
      {
      "ignore_sticky_posts": "1",
      "posts_per_page": "1",
      "p": "7"
      }

  21. Barbara says: September 2, 20114:12 am

    I love the control your plugin offers! It's excellent! Do you have any plans to include options for displaying custom fields? Our site does reviews and we keep the score (ie: 8/10) in a custom field called "rating". It would be great to be able to show that next to the title.

    • Patrick says: September 2, 201112:21 pm

      Thanks for the donations everyone.
       
      Great idea Barbara. I will have a look at doing that for the next update.
      I will also look at documenting the WP_query options that relate to custom fields.
      You can do stuff like showing just posts that have a rating greater than 5 or display a list of posts ordered by rating.

  22. CJ says: September 3, 20116:29 am

    Hi,

    I am trying to find why there is an extra < at the beginning of the read more elipse on http://www.insideperformance.ca/clinicscamps/ sidebar only on the first post excerpt. Any ideas?

    Thanks!

    • Patrick says: September 3, 201112:04 pm

      Hi CJ,

      Can you post the code you are using for the "Widget output template" and if possible the source of the "General Skills Clinic" post.

  23. PokerGob says: September 4, 20115:43 am

    Is it possible to align the text around the thumbnail image?

  24. Patrick says: September 6, 201112:35 pm

    Hey updated to 1.0.5.

    • Added ability to display custom fields. Add to the output template in this format {META[name]} where name is the custom field name (thanks Barbara for this suggestion)
    • Added option to truncate title and excerpt by number of words instead of just chars. This should be useful for displaying the excerpt without words getting trimmed off.
    • Rewrote the WordPress excerpt trimming function to strip code within style and script tags correctly. This should fix conflicts with plugins such as Sharebar.
  25. Jordan says: September 7, 20113:10 am

    Hi Patrick,
    I noticed the excerpts now strip the paragraph tags. My excerpts looked alot better before with the line breaks. Any way this is controllable? Also does it strip hyperlinks? Let me know Thanks!

    • Patrick says: September 7, 20113:23 pm

      Hi Jordan,
      Yeah that was a bug introduced in 1.0.5 I just fixed it then and updated the plugin. The output should now be the same as 1.0.4. Also FYI all tags are stripped except for A, P and BR.

  26. judd says: September 16, 20116:20 am

    Looks just what i am looking for....is it compatible with 3.2.1

    • Patrick says: September 16, 20119:48 am

      Hi Judd,
      Yes it is compatible with 3.2.1. That is what I am running it on myself.

  27. Pokergob says: September 17, 20117:24 am

    Can you include a default thumbnail if no thumbnail is available?

    • Patrick says: September 18, 20111:39 pm

      Unfortunately no that would be outside of the scope of this plugin. But I am writing a plugin which will improve post_thumbnail functionality and let you chose default thumbnails based on category, tags etc.. And also help migrate over by using the first attachment as a thumbnail or load thumbnail based on meta key value.

  28. David says: September 17, 20119:02 pm

    Hi. A newbie question. I would like to put "posted by" before the author's name, after the ellipse, but have now idea how to do even such a simple thing. I can insert {AUTHOR} after {EXCERPT} and it works fine, but would like to add that bit of text in.

    Your widget works brilliantly. Thank you.

  29. David (as above) says: September 17, 201110:12 pm

    Hey, I did it, and even added a bit of color, and put the excerpt on a new line. I love this stuff, it's better than doing puzzles in the newspaper. know it's elementary for you guys, but here is what I ended up with

    {THUMBNAIL} {AUTHOR} on <a title="{TITLE_RAW}" href="{PERMALINK}" rel="nofollow">{TITLE}</a>. {EXCERPT}

  30. David says: September 17, 201110:14 pm

    I'm afraid that didn't post correctly: maybe it interpreted the code. Perhaps you could sort that out for your other readers.

    • Patrick says: September 18, 20111:30 pm

      Glad you worked out the problem. Fixed your comment as well.

  31. Jack Godot says: September 29, 20119:54 pm

    Hi
    How do I query for a taxonomy? The WP_Query codex explains that it now must be done with an array. I understand the codex but I am unsure how to adopt the syntax according to your example above.

    Cheers Jack

    PS I tried the following but it didn't work.

    {
        "tax_query": [
            {
               "subject": "iran"
            }
        ]
    }
    • Patrick says: September 29, 201111:22 pm

      Hi Jack,
       
      I assume you are running WordPress 3.1+. The syntax of your query is correct and it is in valid JSON format. The issue seems to be that the tax_query setting is supposed to be in a slightly different format to what you provided.
       
      Try something like this:
       

      {
          "tax_query": [
              {
                  "taxonomy": "subject",
                  "field": "slug",
                  "terms": "iran"
              }
          ]
      }

       
      For future clarification to handle multiple taxonomies you would do something like this (based on example from the WP_query docs)
       

      {
          "tax_query": {
              "relation": "AND",
              "0": {
                  "taxonomy": "movie_genre",
                  "field": "slug",
                  "terms": ["action", "comedy"]
              },
              "1": {
                  "taxonomy": "actor",
                  "field": "id",
                  "terms": [103, 115, 206],
                  "operator": "NOT IN"
              }
          }
      }
  32. Ginny says: September 30, 20111:01 am

    I need to insert a break after the title - right now there is no space between the title and the post. This may be because the columns for the posts are 180px. Can you point me to the correct area of the code to insert the break? I'm familiar with PHP.

  33. Ginny says: September 30, 20111:59 am

    I need to insert a break after the title, just before the post. Where in the code should I look? I'm pretty familiar with PHP.

    • Patrick says: September 30, 201110:12 am

      Hi Ginny,
      Just change your "Widget output template" option to something like this.
      <li>{THUMBNAIL}<a title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a><br/>{EXCERPT}</li>

  34. Jacek says: September 30, 20112:34 am

    Hi

    I trying to use yout plugin on my test site:
    test.darken.pl
    But i want to use it three times on homepage.
    I'm trying to show each choosen category - it works, but when i'm using code for showing category, a post count won't work.

    So for example i put in each widget this code:

    {
        "cat": "6"
    }

    and

    {
        "cat": "7"
    }

    and

    {
        "cat": "8"
    }

    When i do something like this:

    {
        "cat": "6",
    }

    post count work, but it show only newest posts.

    • Patrick says: September 30, 201110:10 am

      Hi Jacek,
       
      The following example is invalid JSON you need to remove the comma (,).

      {
          "cat": "6",
      }

       
      Otherwise you could try overriding all the default settings like this:

      {
          "post_type": "post",
          "posts_per_page": 2,
          "orderby": "date",
          "order": "DESC",
          "cat": "6"
      }
  35. Jacek says: September 30, 20115:57 pm

    Yes, I know it is invalid, but i just describe a situation when post count work.
    I tried your code to override default settings, but it isn't working.

  36. Jacek says: September 30, 201110:17 pm

    Ok, so problem is:
    When I put "cat" or "category_name" in wp_query options box then post count don't work.

    • Patrick says: October 1, 201112:29 pm

      That is strange it works fine on my test server. You could try using category__in instead.
       

      {
          "category__in": [6]
      }

       
      If that doesn't work either can you let me know your WordPress version and if possible the theme you are using so I can do some further testing.

  37. Ginny says: October 1, 20115:41 am

    Thanks! Got it. Now I need to show a thumbnail. In my version of the widget, there is no option for the photo or the thumbnail size, although it does show up in the advanced settings. It's in there; however no thumbnail shows up. Can you help?

  38. Ginny says: October 1, 20115:47 am

    Do I have to upgrade to version 1.0.6? If so, do I have to delete the old version and start over?

    • Patrick says: October 1, 201112:21 pm

      The reason the thumbnail options wouldn't be appearing is because your theme doesn't support the new post_thumbnail setting. You can add support for this feature by adding this code to the themes functions.php file:
       

      if ( function_exists( 'add_theme_support' ) ) {
        add_theme_support( 'post-thumbnails' );
      }

       
      If you are using version 1.0.4 of the plugin then there is no reason to update other than some new options. However if you are using 1.0.5 I would recommend updating since 1.0.6 has a couple of bug fixes. You can see the change log here http://wordpress.org/extend/plugins/recent-posts-plus/changelog/. BTW you don't have to delete the old version just overwrite the files from the old version and your current settings will remain.

  39. Ginny says: October 1, 20112:36 pm

    Thank you for your response. I am working with the Prestige theme and It is not very cooperative. I did ad the functionality to the functions.php file, but it is still not working. I may be at the end of the road, but appreciate any ideas you have.

    • Patrick says: October 1, 20119:37 pm

      Sorry to hear it still isn't working are the thumbnails options still not showing? As long as you have WordPress 2.9+ and the theme supports post_thumbnails then it should work. I can't test it with your theme since there isn't a free version available but occasionally some complex themes can cause issues (although they shouldn't since the plugin only uses basic core functions).

  40. Ginny says: October 2, 20114:02 am

    I will stay at it. This theme does not play well with others, IMO.

  41. David says: October 4, 20114:36 am

    Hi,
    any chance I could use the posters (Gr)avatar?

    • Patrick says: October 4, 201110:42 pm

      Hi David good suggestion I have updated the plugin with this option. Update to 1.0.7

      1.0.7 changelog:

      • Added option to display post author's avatar. Using `{AUTHOR_AVATAR}` tag.
      • Added ability to add raw PHP code to the widget output template.
  42. Ginny says: October 5, 20114:10 am

    Permalink issue: I'm using widget in 3 separate columns in a sidebar. Each column has a different post in it. When I mouse over the links, they show the correct post link; however when I click on the link, it takes me to the most recent post every time. Any ideas?

    • Patrick says: October 5, 201110:13 am

      Sounds like a strange issue you are having is there any possibility you could send me a link to the page?
       
      What are you using for the widget output template?

  43. David says: October 5, 20115:59 am

    Wow, thanks for that. I found that '{author-avatar}' was a bit big, so used the php styling you have suggested, reduced the avatar size to 20 (to match "decent comments" plugin) and added '{author]'. Then a couple of line breaks at the end, and it looks great.
     

    <l>
    <?php echo get_avatar(get_the_author_meta('user_email'), 25); ?> Â{AUTHOR} Â on
    <a title="{TITLE_RAW}" href="{PERMALINK}" > {TITLE} < /a>
    {EXCERPT} <br><br>
    </li>

     
    I hope that code comes out legibly!

  44. Ginny says: October 6, 20112:10 am

    I have not posted the site yet - posted locally. I'm using A F PW to display the most recent post on the top content area. Below it is another content area with 3 columns, each showing the next most recent post. All that works well on the home page and when mousing over the link, the correct URL shows.Here are my settings:
    {
    "offset": "1"
    }

     
    <a title="{TITLE_RAW}" href="{PERMALINK}" rel="nofollow">{TITLE} {AUTHOR} {DATE}</a>{EXCERPT}<a href="{PERMALINK}" rel="nofollow">Read more</a>
     
    I'm using a custom single.php page; here's the code that receives it:
     

    <strong>Widget Ready</strong>
    This single is widget ready! Add one in the admin panel.

    <!--END content DIV-->
     
    So the problem is that I need to use this page for all posts and without additional code, it refers back to the main post. It looks like I need to add some conditional statements that call the next most recent post from column 1, and so forth. Would that code go in the advanced-fpw.php? and if so, where?

  45. Ginny says: October 6, 20112:12 am

    So that single.php code did not come out. here it is:

  46. Ginny says: October 6, 20116:07 am

    <?php if (function_exists('dynamic_sidebar') dynamic_sidebar('Single')) :

    • Patrick says: October 6, 20118:51 am

      I think I know what your problem is actually. Are you using 1.0.7? There was a problem when I sent the updated plugin through which I rectified immediately, you would have had to check for updates almost at the same time I sent the update, which is really unlucky . Anyway just update manually with this zip http://downloads.wordpress.org/plugin/recent-posts-plus.zip and the issue should go away.
       
      Otherwise if you are still having issues I am not sure I recreated your set up as best I could and didn't have any problems.

  47. Misty Weaver says: October 9, 20118:27 am

    Firstly, this is the best custom widget ever! I concur with Barbara, I would love to display custom fields in the widget. We often have multiple authors and I haven't been able to figure out the WP_Query or display to make it recognize co-authors plug-in or even better just list what I put in a custom field called "recent_posts" instead of authors. Right now, I'm adding the authors names to the excerpt and it looks silly. But lo, I cannot publish without all of the authors names :)

    • Patrick says: October 9, 201110:55 am

      Hi Misty,
       
      Custom Field support was added in version 1.0.5 just add the following tag to your Widget output template: {META[recent_posts]}
       
      {META[name]} Displays the value of the specified custom field. E.g. {META[Currently Reading]} or {META[Rating]}. Note: Only returns the first result.
       
      You should be able to use the raw PHP support that was added in 1.0.7 to utilize the co-authors plugins template functions.
       
      For example (note I based this on the co-author plugin documentation it should work for this http://wordpress.org/extend/plugins/co-authors/ or this http://wordpress.org/extend/plugins/co-authors-plus/ plugin):

      <li>
          {THUMBNAIL}
          <a title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a> by <?php coauthors(); ?>
          <p>{EXCERPT}</p>
      </li>
  48. Dave White says: October 13, 20118:44 am

    Excellent plugin, thank you.

    • Patrick says: October 13, 201110:13 pm

      Thanks Dave

  49. Jonas Grumby says: October 14, 20117:58 am

    Hi Patrick, This plugin exhibits one bit of weird behavior which is that if you exclude a category from displaying in the widget, then when you visit that category page the widget does not show any links at all. Any thoughts? Thanks.

    • Patrick says: October 14, 20111:36 pm

      Hi Jonas,
      I am trying to recreate your problem on my testing server but so far I haven't been able to. So you have something like this in the WP_Query option to show all categories except one (in this example category 3):

      {
      "cat":"-3"
      }

       
      But when you visit the category page for category 3 the links don't show at all. Is that correct?
       
      Can you send me a link to the page that isn't working, and let me know what version of WordPress you are running?

  50. Wayne says: October 21, 20112:09 pm

    On a regular post page, I want to be able to show a list of custom posts that relate to regular posts based on commonly named tags (and only where the tag names are equal)? Is there a way to extract the tags from the current regular post (e.g. using get_the_tags() or similar) and use the result in the "tag:" field of this plug-in?

    • Patrick says: October 21, 20112:32 pm

      Hi Wayne,
       
      I am not completely clear on what you are trying to do.
       
      If you are trying to dynamically modify the WP_Query param to insert a tag setting based on the displayed regular post then it can't be done with this widget. Have a look at the section in the documentation above under "Utilizing the meta_query option". If it can't be done with the meta_query option then it can't be done. The reason for this is that the WP_Query options are used before the "Widget output template" is parsed so changing it in that way is outside the scope of this widget.
       
      If you are trying to display a list of regular posts, then under them display related posts you could insert PHP code into the "Widget output template" to do this.
       
      However as much as I would like to say this widget can do all the things you want I think it would be a lot easier to just write a bit of custom code and stick it into; your theme, a custom widget, or into a PHP widget (however this last option would be slower since the code would have to be evaled).

  51. Thomas Dale says: October 22, 20117:49 am

    Is it possible to get the posts to display randomly from a given category so every time someone visits the homepage, a different set of posts are displayed? Thanks!

    • Patrick says: October 22, 201110:05 am

      Hi Thomas,
       
      Yes you can do that by adding the following code into "WP_Query" setting and changing the "cat" setting to be the category you want to display them from.
       

      {
          "orderby": "rand",
          "cat": "1"
      }
  52. rob says: November 15, 20113:46 pm

    Great plugin, only thing is, Its all capital letters for the title ?? I'd like it to be normal.

    • Patrick says: November 18, 201110:36 am

      Hi Rob,
      The plugin outputs the title the same way that you enter it. It sounds like your WordPress theme is changing the styling for the title text most likely with the text-transform css attribute.
      See http://developer.mozilla.org/en/CSS/text-transform

  53. Luke says: November 17, 201112:46 am

    Hi, can I insert in a page directly using php code eg. instead using widget area?

    • Patrick says: November 18, 201110:41 am

      Hi Luke,
      I am not sure exactly what you are trying to do but you can insert php code into the widget output template.
       
      If you only want to display a certain list of pages then you can use a WP_Query setting like this:

      {
          "post__in": [2, 3, 4]
      }
      
  54. Kelie says: November 17, 201111:52 am

    This is exactly what I need, but instead of having it output vertically, I am wanting it done horizontally. How would I go about doing this?

    • Patrick says: November 18, 201110:28 am

      Hi Kelly,
       
      That is fairly easy to do but it has more to do with your theme css styles than the widget settings see http://css.maxdesign.com.au/listamatic/horizontal01.htm
       
      Adding the CSS styles below to your theme should work:

      .widget_recent_entries li {
          display: inline;
      }
  55. Darin says: November 20, 20114:24 pm

    Hello,

    Thanks for the plug-in. It is very close to what I need. One question:

    1) I can't get thumbnails to display. Is this because the plug-in does not auto-generate them from images in posts or perhaps my theme (Journalist 1.9) is not compatible?

    Thans,

    --Darin

  56. Darin says: November 21, 20113:36 pm

    O.K., thanks. Auto-thumbnails would be so cool :(

    Meanwhile, I've turned thumbnails off and I'm getting some weird formatting. If you go to my web page you can see the post "The New Top 10" shows the first "<" of the img html code but nothing else. "How to teach kids photography" is jammed into the post before it, "Gotcha" is empty, and "Real, after all" just has the first letter of the post. Something with the plug-in or the theme or...?

    Thanks again...

    • Patrick says: November 24, 20111:27 pm

      Hi Darin,
      I have just updated the plugin to v1.0.8 this should fix the issues you are seeing with the excerpt.

  57. tom says: November 22, 20113:33 pm

    how can i increase the size of the font and change the style of the font? also, there are no paragraphs in my excerpt. any suggestions? thank you for a great plugin!

    • Patrick says: November 24, 20111:32 pm

      Hi Tom,
      The font size can be increased by modifying your themes style sheet (http://codex.wordpress.org/Appearance_Editor_Screen)
       
      For example to change size of the individual elements:

      .widget_recent_entries li a, .widget_recent_entries li {
          font-size: 15px;
      }

       
      For example to change size of the title:

      .widget_recent_entries h3 {
          font-size: 30px;
      }

       
      You can wrap the excerpt tag in a paragraph like this (Widget output template option):

      <li>
      {THUMBNAIL}
      <a title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a>
      <p>{EXCERPT}</p>
      </li>
  58. Sergio says: November 23, 201110:23 pm

    Hey Patrick - First and foremost, excellent plugin. I was on the verge of writing my own when I found this. I like the ability to write your own template using code.

    I found something that is causing issues. I read that you strip out all tags except a, p, and br. What I've found is that if you set an excerpt truncation and, for any post, if it falls in the middle of an anchor tag, the output is not correct.

    It might be a good feature to add an allowed tags field to be edited by the user. Just an idea. If there is a way to fix this, let me know.

    Thanks again, and great work.

    • Patrick says: November 24, 20111:53 pm

      Hi Sergio,
       
      Yeah I noticed that issue just a few days ago as well. The problem is that if you want to truncate text that contains html you run into the problem that the html tags themselves will be counted as well (either in the word count or char count). I can only see two ways to solve the issue:
       
      1. Strip out all html tags in the excerpt (this is what WordPress often does) that way you are only trimming plain text so the truncation algorithm is simple.
      2. Parse the html using DomDocument (http://php.net/manual/en/class.domdocument.php) that way you can accurately traverse the dom and count the number of characters in any of text nodes. Then you can remove proceeding nodes safely. The issue with this is that processing html text with DomDocument is relatively slow especially if you need to do it 15+ times in one page load.
       
      I have updated the plugin to 1.0.8 and decided to go with option 1 for now. While this will strip the links from the text I have found a way to preserve formatting by calling wpautop on the truncated text.
      I might add the second method as an option at a later stage since it should be ok if the output is cached and would allow html in excerpts.

  59. Sergio says: November 25, 20111:23 am

    I think that's a good option to have at a minimum so that the output is more assuredly not going to look odd. I agree that since WordPress does it, it should be a good approach. One result of this, as you mention with the use of wpautop, is that you may get extra paragraph tags thrown in. Not an issue, but I needed to update the custom code a styling a bit.

    I've seen customizable allowed tags lists in other plugins and thought it was a nice approach to the issue.

    I'll keep an eye out for updates. Thanks again for the quick response and action.

    • Patrick says: November 25, 20119:06 am

      Glad to hear it is working for you. Yeah wpautop can sometimes add extra paragraphs but I think that is the best option ultimately. Adding a list of allowed tags won't fix the issue since those allowed tags will still be treated like text and potentially chopped up leading to weird markup.
       
      I wrote a blog post last night about the differences with trimming html and text and wrote a class that can handle html trimming similar to what I outlined in the comment above http://www.pjgalbraith.com/2011/11/truncating-text-html-with-php/. Of course the html method is a lot more heavyweight than the text trimming functions but I might add it to Recent Posts Plus as an option in the future for people who need it.

  60. Darin says: November 26, 20116:04 am

    Hey Patrick,

    Excellent update. Loos great--but one "bug" has crept in. If you look at my page you'll see two posts ("The New Top 10" and "Gotcha!") that have unexpected space after them. What they have in common is that there is a picture posted first, before any text. In the case of the "Top Ten" it is all pictures. The plug-oin seems to be leaving space for every picture--thus "top 10" has lots of space since it has ten pictures.

    But looks great otherwise (though I'm still dreaming of auto-thumbnails... :)

    --Darin

    • Patrick says: November 26, 201112:02 pm

      Yeah it's definitely looking better now. I see what you mean about the empty paragraph tags though, I'll see what I can do about it later.
       
      I do have a Default Post Thumbnail plugin in development if you want to try it out let me know and I can send you a copy.
       
      Patrick

  61. Darin says: November 26, 201112:20 pm

    Hey Patrick,

    I'd be happy to test out your thumbnail plugin and/or any updates to this one.

    --Darin

  62. Jonny007-MKD says: December 3, 201112:22 pm

    Hi,
    I really love your plugin! It is very customizable and exactly what I need.
    What I don't like are the -tags around the ellipsis and that if I set it to empty it still appears. I want to have the (more) link right behind the text not beneath it.
    Can you help me?

    greetz
    Jonny007

    • Patrick says: December 7, 20115:09 pm

      Hi Jonny,
      The plugin doesn't add any tags around the ellipsis. Can you please explain the issue in a bit more detail I am sure it won't be too hard to fix.
      Patrick

  63. Jeff says: December 4, 20118:50 am

    Dear Patrick,

    We are using qtranslate and the stripping of the title tags means we lose the language tags and end up with a concatenation of both languages (Chinese and English in this case)

    I just dropped the strip_tags to make it work:
    // $instance['title'] = strip_tags($new_instance['title']);
    $instance['title'] = $new_instance['title'];

    Maybe there's a nicer way to do it? It looks a lot like dealing with the more tag, but not tossing everything away. These are the qtranslate tags with some sample text:
    News消息

    Thanks,

    Jeff

    • Patrick says: December 7, 20115:04 pm

      Hi Jeff,
      Yeah that isn't something that I considered. You can fix it by just adding the title with PHP in the Widget Output Template.

      <li>
      <a title="{TITLE_RAW}" href="{PERMALINK}"><?php the_title(); ?></a>
      {EXCERPT}
      </li>
  64. Horia says: December 6, 20112:30 am

    Hey, nice plugin. Is there a way I can download version 1.0.6 of the plugin?

  65. Cor van Noorloos says: December 8, 20115:21 am

    Hi Patrick, I'm not entirely sure if this would be possible. But would it be possible to also limit the post excerpt to the first paragraph? (or the first X amount of paragraphs)

    Best regards,

    Cor

    • Patrick says: December 8, 201112:10 pm

      Adding something like the below to your Widget Output Template should work:

      <li>
      {THUMBNAIL}
      <a title="{TITLE_RAW}" href="{PERMALINK}"><?php echo substr(get_the_excerpt(), 0, strpos(get_the_excerpt()."\n", "\n")); ?></a>
      {EXCERPT}
      </li>

      Select first block of text before the first line break.
       

      <li>
      {THUMBNAIL}
      <a title="{TITLE_RAW}" href="{PERMALINK}"><?php echo preg_match('~(<p>.+?</p>){1}~i', get_the_excerpt()); ?></a>
      {EXCERPT}
      </li>

      Selects the contents of the first paragraph tag.
       
      See this thread for more info on using php to extract the first paragraph from text http://www.sitepoint.com/forums/showthread.php?624319-Extracting-the-first-paragraph-of-a-content

  66. Jonny007-MKD says: December 8, 20116:58 pm

    Hi Patrick,

    At my site there are [p]-Tags around the ellipsis. So if they're not from the plugin, do they come from WordPress? Thanks for your help!
    greetz
    Jonny007

    • Patrick says: December 8, 20119:37 pm

      I assume you mean <p></p> tags around the ellipsis? If that is the case then it shouldn't be happening and I haven't seen that behavior before.
      Can you send me a link to the website so I can have a look at the page source? Also can you post a screenshot of the widget settings?

  67. Jonny007-MKD says: December 9, 20112:52 am

    Hi,
    Now that i looked into the source I noticed that there are no real <p></p> tags around the ellipsis. All that happens is that the excerpt is wrapped into it and the ellipsis is afterwards.
    <p>Excerpt Body Text&#8230;</p>
    <a title="Title" href="URL">(more)</a>

    This generates the same behaviour as when the <a> tags are in <p> tags.
    Is there some way to change this so there is no newline for the (more)? Setting display:inline for p doesn't work since then the newline after the date is also erased.
    <li>{THUMBNAIL}<a class="title clearfix" title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a><p class="post-date">{DATE}</p>{EXCERPT}<a title="{TITLE_RAW}" href="{PERMALINK}">(more)</a></li>

    thanks and greetz
    Jonny007

    • Patrick says: December 9, 20112:09 pm

      Yeah no wonder you are having issues since this isn't a use case I accounted for. I have updated the widget with a new Widget Output Template tag {ELLIPSIS}...{/ELLIPSIS}.
       
      You can now do something like this:

      <li>
      {THUMBNAIL}
      <a title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a>
      {EXCERPT}{ELLIPSIS}... <a title="{TITLE_RAW}" href="{PERMALINK}">(more)</a>{/ELLIPSIS}
      </li>

       
      Also I removed the site info from your previous comment.

  68. Nicole says: December 9, 201110:06 am

    Hi Patrick,

    Thanks for this plugin. One question...I'm trying to offset my posts by the first three (I.e. I want to prevent the first three posts from showing...). I put:

    {
    "offset": "3", //number of posts to skip over
    }

    In the WP_Query Options field but the first three posts are still showing up...am I missing a step? Thanks for your help!

  69. Nicole says: December 9, 201110:14 am

    Oh! Never mind...I just removed the , and it worked! I could hug you for making this plugin. Thank you!

    • Patrick says: December 9, 20112:12 pm

      Glad to hear you worked out the issue :D

  70. Jonny007-MKD says: December 13, 201110:24 am

    Hi Patrick,
    thanks a lot, this is great! This whole plugin is great :) Thanks again

    greetz
    Jonny007

  71. Sam says: December 21, 20113:12 am

    I hate to request features on free software, but maybe somebody can help me think of a way through this. I am using a couple of Recent Posts Plus widgets on my static home page. I would love it if there was a way at the bottom of the widget, after the list of posts, to see more from the category. For example, one widget is for News about the school. Would be great if I could either (1) click the News title or (2) click a link at the end of the list for more news articles. Another widget is for the Quote of the Week, but it'd be great if a user could click the title or a More link to get previous quotes of the week. Etc.

    • Patrick says: December 22, 20113:42 pm

      Hi Sam,
      If I understand what you are trying to do correctly that would be very difficult (probably impossible) to do using this widget. You have to remember that while it is very flexible it was intended as a replacement for the default recent posts widget. In your situation it would be best to get a developer to create a custom widget that can perfectly fit your requirements.
      Patrick

  72. Alan says: January 22, 20126:25 pm

    Hi Patrick,

    Really would like to use your excellent widget on a redesign I am working on, but I am wondering if it's possible to only display the thumbnail for the first post retrieved? I know I could do this easily with CSS, but that would require the user to download thumbnails they aren't even seeing, which is less than optimal. Thanks in advance!

  73. Alan says: January 22, 20126:55 pm

    Nevermind, Patrick. I think I managed to hack it together with my meager PHP skills. I just edited recent-posts-plus.php starting at 241, changing it to this:

    $count = 1;

    while ( $the_query->have_posts() ) { $the_query->the_post();

    $ID = get_the_ID();

    if ($count == 1) {

    if($include_post_thumbnail == "false") {

    $POST_THUMBNAIL = '';

    } else {

    $POST_THUMBNAIL = get_the_post_thumbnail($ID, array($post_thumbnail_width, $post_thumbnail_height));

    }

    } else {

    $POST_THUMBNAIL = '';

    }

    $count++;

    It appears to be working, but if you think this was the wrong method, I am all ears. Thanks again, this plugin was a big help.

    • Patrick says: January 31, 201212:42 am

      Hi Alan,

      Yeah your solution should be fine as long as you don't need to create a second instance of the plugin that shows more than one thumbnail. If that is the case you may be better doing it with CSS.

      Patrick

      Edit: Sorry for the late reply your message got stuck in the spam queue.

  74. Thomas says: February 1, 20129:01 pm

    I would need to have a line break within the title of the widget. But if I use "first linesecond line" the "" will be erased after saving the widget.

    Is there any chance to include some HTML in the title of the widget

    • Patrick says: February 3, 201210:51 am

      The plugin applies the default in-built WordPress widget title filters which escape any html. Unfortunately that is how WordPress works by default.
       
      You could modify the plugin code change this:
      $title = apply_filters( 'widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title'], $instance, $this->id_base);
       
      To this on line 70:
      $title = empty($instance['title']) ? 'Recent Posts' : $instance['title'];

  75. Beste 10 Wordpress Plugins | Webvision Media says: February 2, 20129:25 pm

    [...] WP Super Cache Een plugin die zorgt dat je pagina’s op je website sneller laadt. Het is een vrij uitgebreide plugin, dus het kost even tijd betreft onderzoek, maar dan heb je ook wat. Recent Post Plus Ik heb hem nog niet zolang geleden ontdekt, maar ik ben wel erg blij dat ik hem gevonden heb. Een widget voor de meest recente blog post. In de widget zelf kun je stijl helemaal aanpassen hoe je het wilt, dus geen algemene instelling maar bij iedere widget die je installeert kun je dit anders doen. In het veldje wp-query options kun je door middel van codes aangeven van welke category je de recente berichten wilt tonen, of berichten met bepaalde tags, of van een bepaalde autheur enzovoort. Je hebt dus zelf volledig de controle over deze widget. Een voorbeeld vind je op de hoofdpagina van GasamenOpreis.nl, rechts gebruik ik deze widget onder, “Nieuwe Oproepen”. Meer over deze plugin. [...]

  76. Freddy says: February 4, 20124:30 am

    Great Stuff!
    Any chance of adding more Template Tags to the Widget Output Template? Perhaps {CATEGORY} to display the category that the post falls under. . . . etc?
    Thanks for your work! I am using it as an administrative tool to display my posts in alphabetical order with clickable titles etc.

    • Patrick says: February 7, 201211:07 am

      Sure let me know what tags you would like to see and I will try to add them in the next update.

  77. Freddy says: February 9, 20127:33 am

    MMmmmm, I can only think of CATEGORY and TAGS right now. Perhaps other folks would like others?

    Secondly, is the only way to format the output to edit the CSS sheet? Can we edit the CSS to have them display tightly, so that the DATE, and CATEGORY are on the same line, for example, and there is no blank space before the next line, the EXCERPT, starts?

    Thanks again!

    • Patrick says: February 13, 201210:19 am

      Hi Freddy,
      The plugin doesn't provide any CSS styles. You will need to modify your themes stylesheet to get the result you are looking for.
      Have a look at the section above titled "Examples of Styling the Output".

  78. Phyllis says: February 13, 20123:31 am

    Hi! I was so relieved to finally find a plugin that works - well...mostly. So, three things I'm trying to accomplish but can't:

    1 - I want only one category of posts to show, but when I enter the code in the WP Query Options box, nothing happens (in other words, it's being ignored):
    { cat: "8, -10", }

    2- I want to add a "read more" link and when I enter the code into the Widget Output Template box, my posts excerpts & thumbnail disappear and all I'm left with is the "read more" links. In fact, if I put anything in the Widget Output Template box, my posts disappear.

    3- Finally, I'd like to get rid of the bullet points before the post titles.

    Thanks so much!

    • Patrick says: February 13, 201210:32 am

      Hi Phyllis,
      For number one it is because you have provided the setting in invalid json format. It should be like this:
      { cat: "8, -10" }
       
      If you have any more trouble try pasting the code you are using into this site to validate it http://jsonlint.com/.
       
      For number two can you post the code you are using I have never seen that issue before and it sounds like something is going wrong somewhere. This is what you should use for a read more link:
      <li>
      {THUMBNAIL}
      <a title="{TITLE_RAW}" href="{PERMALINK}">{TITLE}</a>
      {EXCERPT}{ELLIPSIS}... <a href="{PERMALINK}">Read More</a>{/ELLIPSIS}
      </li>

       
      For number three it depends entirely on your theme so you will have to do that with CSS add the following to your themes stylesheet.
      .widget_recent_entries ul {
      list-style-type: none
      }

  79. John says: March 23, 20124:19 am

    So I put the widget in my sidebar. Looks just like the recent posts that comes with word press. I have most updated version of WP. Options Framework is only other plugin I have running.

    help?

    • Patrick says: March 30, 20129:08 pm

      Hi John,
      I am not sure what the problems is?
      This widget has the same output format as the default recent posts widget it just has more customization options.

  80. Krzysztof says: March 26, 20121:52 am

    Hi, I've wanted to replace widget title with prepared image, so I've added a few lines to the plugin code:
    --- recent-posts-plus.orig.php 2011-12-12 05:22:26.000000000 +0100
    +++ recent-posts-plus.php 2012-03-25 17:10:50.401000000 +0200
    @@ -70,6 +70,12 @@
    $title = apply_filters( 'widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title'], $instance, $this->id_base);
    $widget_output_template = (empty($instance['widget_output_template'])) ? $this->default_config['widget_output_template'] : $instance['widget_output_template'];

    + $uploads = wp_upload_dir();
    + if (file_exists($uploads['basedir'].$title)) {
    + $imgdata=getimagesize($uploads['basedir'].$title);
    + preg_match('|.*/([^/]+)\.[^.]+|',$title,$alt);
    + $title = '<img src="'.$uploads['baseurl'].$title.'" width="'.$imgdata[0].'" height="'.$imgdata[1].'" alt="'.$alt[1].'">';
    + }
    echo $before_title . $title . $after_title;

    $output = $this->parse_output($instance);
    I find this patch very useful, but I am not sure if this patch is safe (does not pose a security threat) and if it fits the wordpress plugin coding guidelines (if there are any).

  81. Mark says: April 6, 20123:25 pm

    Hi Patrick,

    I'm having a few issue.
    1.) aligning the text with the top of the image.
    2.) Unable to eliminate "by Jerome Corsi" underneath the title and
    3.) Reduce the space between the title and the description.
    I'm using WP ver. 3.3.1

    Can you help me....Thanks, Mark

  82. Elena says: May 15, 201212:56 am

    Hello, great plug in.
    How can i replace

    [wpdiv id="text" ] and [/wpdiv]
    in function preg_replace()

    My content is follow:
    [wpdiv id="text" ]
    .....................................
    ....................................
    ...................................
    [/wpdiv]

Submit comment