Recent Posts
Purpose
This plugin displays a list of the most recent posts to your blog in a highly customisable way.
This is version 2.6.0.1
. It is compatible with WordPress 1.5–2.6.
Note: If you had the misfortune to download version 2.5.0.7 you may run into problems when you try to update to a newer version. I managed to introduce a circular dependence between this plugin and the Post-Plugin Library which means trying to update either from the admin plugins page will cause an error. Instead you need to delete the 2.5.0.7 version from the server and upload the newer one and the problem should be solved. I apologise for any worry or inconvenience.
The plugin has an options page which lets you change how the output is generated and displayed.
Installation Instructions
<?php recent_posts(); ?> at the place in your theme files where you want the list of similar posts to appear. Lorelle on WordPress has a good guide to modifying themes for plugins. If you are using a widget-ready theme the plugin can be placed from the widget admin page. Use the admin Settings|Recent Posts page to set all the available options. Alternatively, the options can be overridden by passing a parameter to the recent_posts template tag.Usage and Options
The configuration page will help you to set up the plugin to your satisfaction.
If you also install the latest version of Plugin Output Cache the output of this plugin will be automatically cached for efficiency.
Note: If you find that your list of recent posts comes out backwards it is probably because you have MySQL version 4.1.21. That version of MySQL has a bug when a SELECT statement has both DISTINCT and ORDER BY clauses. The latest versions of the plugin (2.5+) avoid this MySQL bug.
Finally…
I look forward to your help in ironing out any issues and implementing any good ideas. The plugin settings page has an option to submit bug reports but general comments can be left below.
Frequently Asked Questions
Is it possible to show the recent posts per category? Something like:
CATEGORY:
*recent post 1
*recent post 2
* and so on…
CATEGORY 2:
*recent post 1
*recent post 2
* and so on…
Yes it is possible but only by calling Recent Posts a number of times which is inefficient (though caching helps). Try:
recent_posts('included_cats=1');
recent_posts('included_cats=2');
...
I would like to know if there is any way to display the recent posts in 2-3 columns?
One way is by fancy CSS/JavaScript… but you can get the result by calling recent_posts() 2-3 times. Let’s say you want 5 posts in each column so you set the limit to 5 in the settings screen. The first time, recent_posts() gets you the top 5 posts; recent_posts(’skip=5′) the next 5; and recent_posts(’skip=10′) the next.
How do I get it so that {link} displays the date instead of the title? If i use the {date} template tag, it shows the date but no link.
You need to use the output template to tell the plugin exactly what to display. For example, if you want a link where the visible text shows the date of posting you could try:
<li><a href="{url}">{date}</a></li>
How do I format the output of the {date} tag?
The blog’s date format is used by default but you can change it by adding a format string. The Codex has a page on format strings. Let’s say you want the date to look like Sunday, January 14, 2007. The correct format string is ‘l, F j, Y’ so you would write
{date:l, F j, Y}
I don’t want my post plugin widget to show on the main page, just the single post page. Is that possible?
Yes. The widgets now let you choose the condition under which they are visible. The condition can be set using any combination of WordPress Conditional Tags, e.g., ‘is_home()’, ‘is_category()’, or ‘is_page()’.
In this case the right condition is ‘is_single()’.
I’m trying to place the plugin output just after a single post but other plugins seem to get in there first. Any ideas?
Some plugins automatically tack on their output to the end of a post’s content. The only way to get something in between is to hope that those plugins offer a way to turn off that kind of behaviour and let you explicitly place their output with a template tag. The good news is that most plugins are cooperative.
I found a script that allows me to put thumbnail images [or anything else] with each post. I was wondering if there was a way to integrate that with this plugin?
If the script stores the thumbnails in a custom field you can use the output template tag {custom} to display them. Try
something like:
<img src="{custom:thumbnail}" alt="{custom:thumbnail-alt}" />
A similar thing can be done with many other plugins.
I want to show the same plugin in two different places but with different output: can I?
Yes. Decide on one of the output templates and other settings you need and set them up from the options pages. The other invocation of the plugin then gets called with passed parameters to get the different output.
e.g., random_posts('limit=3&output_template={custom:another_field}')
I want an output template tag to do xxxxxx. How do I invent one?
You have two choices: a) modify the output_tags.php in the post-plugin-library; b) use the {php} tag.
If you go down route (a) (which is actually very easy) please let me know the new tag and I’ll maybe include it in the next version. If you use the {php} tag do be careful not to start WWIII.
I uninstalled one of your plugins and now my whole sidebar has disappeared. How do I get it back?
You have probably forgotten to remove the code calling the plugin, e.g., recent_posts();.
I find a good practice is to use something like:
if (function_exists('recent_posts')) {
recent_posts();
}
That way, if I ever deactivate a plugin temporarily the website doesn’t fall apart.


117 Comments Add your own
1. Rob | March 17th, 2008 at 6:20 pm
Version 2.5 b3 posted
2. Sue | March 25th, 2008 at 2:12 am
Hi Rob,
I got this running right away, and would like to do just one thing, and that is indent the date by 2 spaces or align it with the link. How do I do that?
Thanks!
Sue
3. Rob | March 25th, 2008 at 8:12 am
Sue: I’m not clear what you mean. Which date? Which link? Could you show me what your output template is?
4. Sue | March 26th, 2008 at 4:48 am
Hi Rob,
I am using this in my right sidebar in the area near the top entitled “Featured”. I have jury-rigged the date by using to push it to the right 2 spaces but would like to affect that indentation using proper code with your plugin. Would I use a div code for that? I am using your date code in the plug in config with the post link.
many thanks,
Sue
5. Rob | March 26th, 2008 at 7:51 am
Sue: Looking at the source code on your page I notice an extra
<ul>in the Featured section. You are probably placing one before the plugin call AND asking for one in the plugin output (the prefix setting). Get rid of one or the other and the output should behave like your other lists… if that is what you want!6. thomas | April 3rd, 2008 at 8:05 pm
Updated my blog to WP 2.5 and after updating the Recent Posts plugin it only shows the message “Post-Plugin Library missing”.
How can I fix this?
7. thomas | April 3rd, 2008 at 8:06 pm
Ah, sorry. Found out I have to install the post-plugin library plugin. I am really sorry.
8. printer | April 4th, 2008 at 5:08 pm
Thanks for this great plugin. Its pefect for the site I am building.
I have a question though, I have this other plugin called “Post Thumb Revisited”. i want to put the thumbnails generated by this plugin to show up before my recent-posts titles in the sidebarwidget. I’m not sure what it is that I should put in the ‘ custum field’ .. i think it should be something like this:
<li>{link}<img src="{custom:function get_thumb}"</li>but what can be the so called ‘custom field’? ‘function get_thumb’ does not work. an url to the folder does not work either. Any hints on this? Thanks!9. Rob | April 4th, 2008 at 6:02 pm
printer: You have two options I think. One is to try out the {image} tag which might do what you want; the other is to use not {custom} — which only works if the other plugin stores things in custom fields — but {php} which will let you call the get_thumb function.
10. online business blogger | April 5th, 2008 at 2:23 am
Rob
can this plugin RecentPost work with wordpress static pages? I have it working with posts but, of course, pages don’t have categories.
forgive me for taking up your time with silly questions, guess I should RTFM
11. Rob | April 5th, 2008 at 3:24 pm
online business blogger: You can choose to have pages included or not.
12. printer | April 7th, 2008 at 9:10 pm
Thanks Rob, i tried what you said.. Both ways worked indeed. I like the php field option. to bad i can not get it to display the thumbnail fot the correct post.. only the first one. i will try some more.. thanks for the hint.
13. Rob | April 7th, 2008 at 9:17 pm
printer: You can imagine that the {php} tag has passed to it the
$resultvariable — an object corresponding to each post with values named after the columns of $wpdb->posts. For example, $result->ID.14. printer | April 8th, 2008 at 12:11 am
Rob, I understand what you mean. I think.. The get_thumb() tag needs a reference to the post. What I now have is
{link} {php:get_thumb()}in my field input. It has to be somthing like{php:$wpdb->posts->$result->get_thumb()}then? I will try some tommorow. thanks15. Rob | April 8th, 2008 at 12:36 am
printer: I’ve just been looking at how Post Thumb Revisited works. Unfortunately, it is set up to give a thumbnail from the current post which is why you have been getting the effect you have. It seems to me that you could use the {image} tag to do the same job. get_thumb() finds the first image in a post and returns a thumbnail of it; {image:0} does the same. You can also specify the size of the thumbnail by adding extra parameters, e.g., {image:0:96) for 96px square thumbs, or in general {image:0:width:height}.
16. adspedia | April 8th, 2008 at 9:39 am
Is it possible to show a area of recent blog posts to my website, thus outside the WP CMS?
17. Rob | April 8th, 2008 at 9:49 am
adspedia: To be honest I have never tried. I notice you visited from a forum page proposing an answer to that question. Have you tried it?
18. Printer | April 8th, 2008 at 12:16 pm
Rob, I understand. I tried it with the {image} tag. Unfortunately it looks like the image get scaled (when I set the settings to display the image smaller). And therefore it looks a little “pixelated” or whatever, instead of creating a real thumbnail of course. But I think I will leave it without an image-thumb in the recent-posts then. I found the ‘Post Thumb Revisited’ plugin a little hard to tweak and manage to my liking. So I will stay with the recent-posts plugin for now. Thanks.
19. Rob | April 8th, 2008 at 12:39 pm
Printer: I think my own plugin should also make real thumbnails instead of just setting the display size — the current situation is a stopgap. So sometime soon real thumbnails may appear.
20. Printer | April 8th, 2008 at 6:58 pm
That would be great Rob. I’m building an illustration blog where different authers will publish there work. A thumbnail would be a nice little extra within the recentposts list. I’m realy looking foreword to it.Thanks very mutch for all the help so far! Ill stay tuned.
21. Rene | April 8th, 2008 at 10:27 pm
Hi Rob,
first of all: I like you’re plugin very much! And your ‘how to’ is very clear.
One question: I’m using the {image} tag in the recent comments. The images show up indeed, but I want some extra space between the image and the text. Is that possible? And, if yes, how? Thanks for your attention in advance.
22. Rene | April 8th, 2008 at 10:39 pm
Oh… I’m sorry. I found the solution right after I posted my question. Quite simple after all. I just added
#recent-posts img {
margin: 0 5px 0 0;
}
to my stylesheet.
23. Rob | April 8th, 2008 at 10:43 pm
Rene: Great! CSS and the output templates make a very powerful and flexible combination.
24. Kuri | April 10th, 2008 at 10:21 am
Thanks for this plugin. However, upon installation, it seems the plugin isn’t picking up on the CSS for links styling? Any advice on what I should do here?
25. Rob | April 10th, 2008 at 2:02 pm
Kuri: I’ve just looked at the source of your page and I wonder what you are using for the output template? Maybe you could send me a bug report from the plugin’s setting/options page and it will tell me the details.
26. Diwaker | April 10th, 2008 at 6:26 pm
I recently upgraded the plugins (using the Wordpress auto upgrade mechanism). Everytime I upgrade your plugins (shared library, similar/recent posts, recent comments etc), I lose the corresponding widgets from my theme and I have to go back and re-enable them. Is this a known issue? Thanks for the great work!
27. Rob | April 10th, 2008 at 9:22 pm
Diwaker: I haven’t had reports of this before… It’s possibly because I tried a change in the registration of the widgets and then switched back. But it could be a real bug … I’ll keep my ears open.
28. Jens | April 13th, 2008 at 11:19 am
Hey!
I have used your recent posts plugin for a while now and it has been working great! Today I used the wordpress upgrade plugin automatically-function to get the latest version, after this it also said i needed the post-plugin library, which i didn’t have before, and i installed it. The problem is, now it doesn work anymore, and i had to remove it from my first page where i used to have my recent posts listed.
The problem was that when it came to fetch the posts, it just stopped and nothing showed, and also the loading of the rest of the page stopped. Do you know what the problem might be? Thanks! // Jens.
29. Rob | April 13th, 2008 at 11:27 am
Jens: First, just check that the old plugin folder has been removed and the new one is in place (with its name-change to ‘recent-posts-plugin’). Then try deactivating the recent posts plugin and reactivating it. That usually does the trick. If not get back to me.
30. Jens | April 13th, 2008 at 11:44 am
Hey, thanks for the quick reply! Unfortunately it doesn’t seem to work. It is in place, I tried to deactivate and activate again, but as you see on my first page, http://www.jensfilipsson.com, it doesn’t load up correctly. If you check http://www.jensfilipsson.com/blogg, i also have a footer that doesn’t load up on the first page. And of course, no recent posts there either.
31. Rob | April 13th, 2008 at 12:24 pm
Jens: Can you leave a bug report from the Recent Posts settings page? It will give me some more information to help debugging.
32. Jens | April 13th, 2008 at 12:27 pm
Done!
33. Jens | April 13th, 2008 at 1:03 pm
Hey, I just went to look at my widgets page, and instead of displaying the list of availible widgets and sidebars, it stops loading at the recent posts widgets, which looks like thiis:
%BEG_OF_TITLE%Recent Posts%END_OF_TITLE%
so I guess there’s something wrong with the code or something somewhere?
34. Rob | April 13th, 2008 at 2:22 pm
Jens: Looking at the bug report you just sent … I’m not seeing any options set. Either there’s something wrong with the bug report (possible) or you need to go to go to the settings page and set up some option values.
Meanwhile I’ll look again at the Recent Posts code.
35. Jens | April 13th, 2008 at 2:37 pm
Hey!
Unfortunately I have options set, they are the same as before I upgraded. And, the problem with the widget not loading correctly I would say suggests that something is wrong.
I’m removing it from my front page now, so that the page can load normally, but I hope to be able to put it back soon, it’s a great plugin! :)
36. Rob | April 13th, 2008 at 5:21 pm
Jens: The problem was traced to the code that strips pseudo-tags from snippets. It is fixed in Post-Plugins Library 2.5b21.
37. Ghost | April 16th, 2008 at 12:56 pm
Hi there Rob,
I don’t know how to use this plugin exactly. I’ve installed everything necesary and i’ve installed the Recent_posts plugin but i dont know how tu put it on the first page . I want to use this plugin to show the latest posts in one single post . For example , let’s say i’ve posted 5 posts recently . I want to show a list with the latest posts in one single post on the front page of my website I hope you understand what I want .
38. Rob | April 16th, 2008 at 3:14 pm
Ghost: I’m not exactly sure what you mean. Is your first page supposed to be blog-like or is it a static page? I mean is it what WordPress calls a page or a post?
You have to insert a call to recent_posts() somewhere in your one of themes’ php files. But where depends on the answer to the questions I asked?
Give me a clue and I’ll be glad to help.
39. Ghost | April 16th, 2008 at 6:43 pm
I think it’s more a static page . I want to have a list of the lastest 30 posts for example on the main page , in the center , like a post . I don’t want the Latest_posts plugin on the right or left , just in the center of my main page .
40. Rob | April 17th, 2008 at 4:55 pm
Ghost: You will need to create a page template to do this. It’s not hard to do but may be unfamiliar. When you create a static page in WordPress it is based on a template. The template contains code and defines where in the page the stuff you enter in the write screen goes. To include recent_posts() in a front page you need to make a copy of the page.php template file, edit it suitably, and then create a page based on it that will be your first page.
For more information visit the codex: here, here, or here
Good luck!
41. Martin | April 18th, 2008 at 12:58 am
Hi
Fantastic plugin, lots of features. Well done !
Quick question , I want to put the {categorylinks} at thetop of the links but it keeps repeating the {categorylinks} for each post link…. how can I get around this ?
{categorylinks}
{date: F j} | {link}
This keeps repeating the category link above each category post. I just want one instance of the category link at the top.
thanks
Martin
42. Rob | April 18th, 2008 at 9:35 am
Martin: I’m sorry but you can’t do that within Recent Posts right now, though I’m considering adding the feature. You can, of course, put the category links before the call to recent_posts() in your theme file.
43. Martin | April 18th, 2008 at 9:56 am
Hi Rob
Thanks for that. Ok , so what is the code syntax to put the category link before the call to recent_posts(). I had a look on the site here but coudnt find any examples.
Thanks
Martin
44. Rob | April 18th, 2008 at 10:00 am
Martin: Just an ordinary WordPress template tag. Probably
<?php the_category(','); ?>.45. Martin | April 18th, 2008 at 10:47 am
OK thanks Rob. That *worked* but I am using two instances of the recent posts on the same page and because its showing posts from two seperate categories, then it will only show the first category title on that page ….. unless I am missing something .
thanks again
Martin
46. Rob | April 19th, 2008 at 10:08 am
Martin: I’m not sure exactly what you are trying to do (sorry). The {categorylinks} tag ‘knows’ which links to show because it can look at the post it is currently displaying. You will need to duplicate that manually. If you know which category id you want to display you can use
get_category_link()to get the category url which you would have to wrap in a hyperlink.If you look at the ‘otf_categorylinks’ function in ‘/post-plugin-lubrary/output_tags.php’ it will give you the idea.
47. Arwen | April 19th, 2008 at 2:28 pm
Hi Rob. Firstly I want to let you know that I really love your plug-in. I have a simple question, and the answer is probably right in front of my face, but I can’t for the life of me figure it out.
I am building a theme for my site that uses the Recent Posts plugin to show a list of “updates” posts on my sidebar. All of these one-sentence posts will go in the “update” category in my WP. Now I’ve easily and quickly configured your plug-in so that it only shows the posts from the “update” category, but now how do I exclude those very same posts from my WP main page?
Essentially, I don’t want them showing up as normal posts on my blog, I want them showing up on the “updates” section of the sidebar. I’m halfway there, I just need to figure out how to exclude them from showing up on the front of my blog when I post a new one.
For example:
The “snippets” on http://www.guitarangel.net
or
The “asides” on http://www.jemjabella.co.uk
48. Rob | April 19th, 2008 at 4:06 pm
Arwen: Your question then is really how do you exclude a category from the list of posts on your front page…
Here are a couple of resources that should help. These, from the Codex and Perishable Press, seems right on the mark. The other, from the Codex, is more general.
I hope these help!
49. Arwen | April 19th, 2008 at 4:37 pm
Thank you very much!
50. Arwen | April 19th, 2008 at 4:48 pm
Thanks… although they don’t really help with the new version of wordpress. They make references to category ID numbers, which I can’t find in the new wordpress admin panel.
51. Rob | April 19th, 2008 at 5:24 pm
Arwen: You might well find that the category slug works instead, though I am not sure. However, it is easy enough to find the category ID. Go to the Manage | Categories screen and hover over the name of the category you are interested in and the browser status bar should show it. If you have the status bar disabled click on the link and look in the address bar of the page you arrive at.
Good Luck!
52. Arwen | April 19th, 2008 at 5:25 pm
Nevermind, I was able to figure it out. Thank you for the help!
53. Blog Bloke | April 25th, 2008 at 8:33 am
When I try to deactivate the plugin it blows apart my template right after section that I used your plugin. Any suggestions?
…BB
54. Lucas | May 13th, 2008 at 11:11 am
I think its a great plugin, too bad it doesn’t have a feature to hide it from the frontpage, so its only visible when a single article is viewed! I do like the option that you can skip a number of posts!
55. Lucas | May 13th, 2008 at 11:13 am
Sorry, I found it!! Great plugin!
56. Lucas | May 13th, 2008 at 11:52 am
I would like to show Recent Posts on pages and single posts.
So I use the option, is_single() on the widget page where it says ’show only if page’. Now the recent articles are not showed on pages.
In the General Settings page there is an options ‘Show static pages?’. Setting this to ‘Both pages and posts?’ also shows pages on the recent posts list. And shoulds it only on single posts!
In the widget page (’show only if page’.) I changed is_single() to is_single(),is_page() and is_single(),is_page(pagename) and to is_single();is_page() with a dot/comma. But the recent posts list is showed on the pages like this.
How can this be done?
Great help!
57. Lucas | May 13th, 2008 at 11:54 am
In the widget page (’show only if page’.) I changed is_single() to is_single(),is_page() and is_single(),is_page(pagename) and to is_single();is_page() with a dot/comma. But the recent posts list is NOT showed on pages like this.
How can this be done?
58. Rob | May 13th, 2008 at 2:28 pm
Lucas: You are heading in the right direction. The condition in the widget settings has to be a valid PHP expression so it should be something like:
is_single() || is_page()i.e., show if a single ‘page’ OR (’||’) a page ‘page’.
59. Lucas | May 13th, 2008 at 11:26 pm
Thanks, you are my person of the day!
60. Venus | May 18th, 2008 at 12:33 am
Hi, I love this script but how do I remove the micro time? I try editing the common_functions.php and recent-posts.php but that would just give me a bug. I know I’m doing something wrong. I try to take out:
function ppl_microtime() {
list($usec, $sec) = explode(” “, microtime());
return ((float)$usec + (float)$sec);
}
and
$result = poc_cache_fetch($cache_key);
if ($result !== true) return $result . sprintf(”“, 1000 * (ppl_microtime() - $start_time));
function check_post_plugin_library($msg) {
$exists = function_exists(’ppl_microtime’);
if (!$exists) echo $msg;
return $exists;
I know it doesn’t really do anything to the page layout but I’m just trying to use less process on the server as possible. Thanks
61. Rob | May 18th, 2008 at 9:03 am
Venus: The timing load is trivial compared to the load imposed by the plugin.
62. Mattias | May 19th, 2008 at 4:52 pm
Just updated to 2.5.0 and my configuration broke :( I’m using
recent_posts('included_cats=1');, has something been changed or why are the pages showing up as well?General Settings -> Show static pages? is set to “No pages, just posts”
Using WP 2.5.1
63. Rob | May 19th, 2008 at 5:30 pm
Mattias: Just fixed in version 2.5.0.3 of Post-Plugin Library. I messed up the code yesterday while making everything WP MU compatible.
64. Mattias | May 19th, 2008 at 5:42 pm
Ah I see, shit happens :P Good work!
65. Lazy | May 20th, 2008 at 8:44 am
Hi,
i`m not sure how to use {imagesrc} and {image}.. is there a page which explains these two new tags to me? ;)
have a nice day
Chris
66. Rob | May 20th, 2008 at 10:17 am
Lazy: Try this full listing of the output template tags and their usage. If you have more questions just ask.
67. Karl Bedingfield | May 26th, 2008 at 9:53 pm
Hi there,
Love this plugin :)
Is there a way for me to get the date to display 26:05:2008?
Many thanks
Karl
68. Rob | May 28th, 2008 at 9:33 am
Karl: You have to supply a date format string to the {date} tag. The details are in the PHP docs.
You might try:
{date:d:m:Y}69. Rob | June 4th, 2008 at 10:41 am
If you had the misfortune to download version 2.5.0.7 you may run into problems when you try to update to a newer version. I managed to introduce a circular dependence between this plugin and the Post-Plugin Library which means trying to update either from the admin plugins page will cause an error. Instead you need to delete the 2.5.0.7 version from the server (Post-Plugin LIbrary too) and upload the newer one and the problem should be solved. I apologise for any worry or inconvenience.
70. John | June 19th, 2008 at 2:57 am
Is there a way to make it diplay ALL the posts? (no limit)?
Great plugin otherwide, thx !
71. John | June 19th, 2008 at 3:18 am
nevermind, got it….line 171, THX
72. Rob | June 19th, 2008 at 2:41 pm
John: I’m glad you found what you wanted. I was going to suggest using a very large number!
73. Karl Bedford | June 19th, 2008 at 10:02 pm
Hi there,
Love this plugin.
I just noticed that although I set in Recent Post admin not to show current post it shows currrent post.
Any idea what might be causing that? Could it be a plugin conflict?
I am using current build of plugin and library.
Thanks
Karl
74. Rob | June 20th, 2008 at 9:47 am
Karl: I’m not able to duplicate that here. Could you send me a bug report from the plugin’s settings screen — it might help me notice something?
75. Karl Bedford | June 20th, 2008 at 6:17 pm
Hi there,
Thanks for replying: I have found the problem - it is my coding for a feature function I am using for my front page. You can view my code here: http://paste-it.net/public/d22077d/
Is there anything that can be changed to my code to stop the conflict?
Thanks in advance.
Regards
Karl
76. Rob | June 20th, 2008 at 9:31 pm
Karl: You can try using wp_reset_query() to reset the original query after you have finished doing your own query. You could also try using the WP_Query class directly.
I hope you’ll let me know what works.
77. Karl Bedford | June 21st, 2008 at 6:13 am
Hi Rob,
Thank you for the post. I am not that great with PHP, in what context (where would I) would I put the reset code?
Sorry to be a pain :)
Thanks
Karl
78. Rob | June 21st, 2008 at 10:03 am
Karl: I’d try putting it after each of the ‘endwhile’ statements:
You might get away with just the one instance after the last endwhile but you’d have to experiment to see what works.
79. Karl Bedford | June 21st, 2008 at 2:10 pm
Hmmmmmm, still appear to be having problems. I tried the WP Query Class but it still showed the current post in the list.
I have found out that when this block is removed the current post is hidden: http://paste-it.net/public/ocd30e5/
I took out the timthumb.php line from this code to see if that made a difference - it did not.
Is there anything else in tis block that may cause problems?
Thanks for your patience.
Karl
80. Rob | June 22nd, 2008 at 11:37 am
Karl: sorry to take some time replying — you got lost in spam for some reason.
I can’t see any obvious difference between the two blocks that might matter.
You might try this: edit the Post-Plugin Library file common_functions.php. Around line 200 you’ll find the function ppl_current_post_id. Replace it with the version below:
I am clutching at straws here and guessing that maybe the global isn’t setup right for some reason. This may or may not help. Let me know.
81. Rool | June 22nd, 2008 at 7:48 pm
Hi Rob,
Great plugin this is but i have 2 questions.
1. When i put in the settings by output this code: {date:Y, F} and then save it. I take a look at my website an see the same code {date:Y, F} it doesn’t show the date ?? Take a look at http://vtbl.nl and you see what i mean.
2. I have a plugin installed who put icons by the categories. Is it available to show this icon in front of the headline? I also want the time before the headline.
Grt Rool
82. Rob | June 22nd, 2008 at 9:18 pm
Rool: 1) It looks like you’ve put the date tag in the prefix codes box and not the output template. The prefix and suffix aren’t interpreted for tags (right now … I have been thinking of offering that option). I may be wrong–let me know.
2) The other plugin can probably be included but it really depends how it works. Someone has done something similar: see this comment.
83. Steve | June 24th, 2008 at 1:19 am
Question.
Can I use this plug in to display the titles of specific posts in a category?
Right now, displaying the following in a sidebar…
Instead of the 10 most recent posts, I want to display only selected posts from one category.
These are “events”. I only want to display the events that happen in the future.
Can I do this? Can you help?
Thanks!
84. Rob | June 24th, 2008 at 9:54 am
Steve: Yes, you can choose to show just future posts from a particular category.
85. Steve | June 24th, 2008 at 1:00 pm
Rob,
Thank you. I’ve been playing with it a bit and got it to display specific posts in one category.
Is there a way to display them in a specified order? These posts are categorized as “events” and although we post them all the time, we want to be able to display the next event at the top of the list without changing the post date. Maybe use a custom field with the start and end dates for the event?
Also, is there a way to add a second widget that calls a specific post from a different category? With that one I want to display the title and the first 115 characters of the post and the publish date. Either that or use a custom field to show “last updated” date. This would be for current conditions at a location (we would display water temp at a quarry).
My development area is dev.brownstonepark.com
Thank you!
86. Rob | June 24th, 2008 at 3:03 pm
Steve: The custom field sounds like a good idea. You’ll see that you can sort your output according to any output tag, including {custom}. It’ll be easiest if the date format you choose sorts naturally.
It is possible to have more than one instance of recent posts on a page by passing a parameter string. You can’t, however, do that with the plugin as a widget. You would have to insert the code calling recent_posts() into your theme.
If you need further help let me know.
87. Steve | June 24th, 2008 at 4:31 pm
It is possible to have more than one instance of recent posts on a page by passing a parameter string. You can’t, however, do that with the plugin as a widget. You would have to insert the code calling recent_posts() into your theme.
Thank you - I will continue to research. Can you help with the recent_posts() ? I’m terrible with this coding stuff, but will give it a try.
88. Rob | June 24th, 2008 at 9:19 pm
Steve: I’ll be glad to help out.
89. Steve | June 25th, 2008 at 1:49 am
Okay, totally lost.
My dev site is at dev.brownstonepark.com, and in the right sidebar has a section called Upcoming Events.
I created a custom tag called event_start_date and set the value to be yyyymmdd (ensure order) and set it to display ascending for the sort output by. That is not quite working correctly, but I can not figure out how it is sorting (it’s not post date).
For the above I’m using the widget.
Can not figure out the code to add to the sidebar.php file to add the second string to pull up only one specific post. I’m going to do a special for CSS formatting and display only one post - always the same post - that will list the current water conditions.
Suggestions?
90. Steve | June 26th, 2008 at 10:25 pm
Rob,
Not to push, just wanted to check in with you about my above question.
Also, once I get this working, I’d like to contribute to you in some way for your time.
Looking forward to hearing from you.
91. Rob | June 27th, 2008 at 10:24 am
Steve: Sorry for the hiatus — it’s been a bad few days…
Can you let me know some more detail? The output template in particular and how you are setting up the sort order.
As for the water conditions post… Let’s proceed by stages. First can you place
<?php recent_posts(); ?>in your theme to get output (even if not the right output) in the right place?Once you have the output in the right place we have to work out what parameter string to pass to get the right output. The parameter system works by starting with the options as set on the settings screens and then making changes. That means you have to handle two aspects: removing any unwanted settings and adding the settings you want to get the water conditions post. Since I don’t know the baseline settings I can only help (right now) by suggesting the parameter string to get the right post. I’d try something like:
<?php recent_posts(’limit=1&included_cats=23′); ?>
where ‘23′ should be replaced with the category ID for the water conditions.
Does that make some sense?
92. Craig | July 13th, 2008 at 1:36 pm
Hi Rob, I’m getting an error when I call Recent Posts:
Warning: Cannot modify header information - headers already sent by (output started at …
That’s when using this plug-in: Who Sees Ads ? Manage your Ads, Control Who Sees Them
Any thoughts?
93. Craig | July 13th, 2008 at 2:29 pm
BTW — it would seem that the plug-in is trying to set a cookie on the lines it’s erroring out on…
setcookie(’wp_ozh_wsa_visits’, $visits, $time+60*60*24*365, $url['path'] . ‘/’);
setcookie(’wp_ozh_wsa_visit_lasttime’, $time, $time+60*60*24*365, $url['path'] . ‘/’);
I’m calling Recent Posts on my homepage, which isn’t WP-driven. I’ve no idea why Who Sees Ads is running when Recent Posts v1.3.3 is called, but seems to be having some conflict here.
FWIW: the Recent Posts output after the header warning/error is still correct.
94. Rob | July 13th, 2008 at 9:33 pm
Craig: You’ve got me puzzled several times over. The current version of Recent Posts is 2.5.0.11 — if there ever was a 1.3.3 it was a long time ago! Are you sure it’s the right Recent Posts plugin? Or maybe it’s just a typo? Tell me more!
95. Craig | July 13th, 2008 at 10:36 pm
Too true Rob! I’m laughing at the mistake there — it’s v1.3.3 of the other plug-in, not yours! Yours is up to date with the same results. :)
96. Maria | July 13th, 2008 at 10:55 pm
Hi Rob,
I’m trying to have two instances of this plugin on the sidebar. The first will have all the categories but three and the second will show two of the three excluded and at some point, I’ll want to get a separate list for that last excluded category.
So in other words, here are the lists:
1. all categories but A,B,C
2. B,C
3. A
List 1 will work, but when I try to do List 2, it prints “None Found.” I’ve tried to do the exclusion call in the first list, then I tried the inclusion call, but neither works.
97. Maria | July 13th, 2008 at 11:02 pm
Nevermind. Stupid me. I had forgotten that in the admin panel, I had already set to exclude B and C, which is why it didn’t show up.
98. Rob | July 14th, 2008 at 9:49 pm
Craig: Have you had any insight from Ozh?
99. Rob | July 14th, 2008 at 9:49 pm
Maria: Easy to do!
100. Craig | July 14th, 2008 at 11:42 pm
None as of yet Rob — seems he’s on Vaca. :\
I’m not sure where the issue is — I suppose his plug-in.
If nothing jumps out at you Rob, I guess I’ll just have to wait and see until he comes back in August. humm
101. Rob | July 15th, 2008 at 11:09 am
Craig: I hate it when one plugin developer says the problem is with another developers plugin… so I won’t do that. But the error message happens when Ozh’s plugin tries to set cookies after the page has already sent headers. Maybe that’s something to do with your page not being ‘WP-driven’. (BTW how do you get Recent Posts working if the page is static, non-WP?)
102. Craig | July 15th, 2008 at 11:43 am
Howdy Rob,
These two lines are all you need to run recent posts on a non-wordpress page:
103. Craig | July 15th, 2008 at 11:45 am
crap — no PHP… um… maybe with the code tag:
104. Rob | July 15th, 2008 at 2:49 pm
Craig: I wonder if that unnescessary ‘echo’ might not be the root of the problem? Try removing it (the plugin echoes automatically) and see if the header problem vanishes.
105. Craig | July 17th, 2008 at 9:57 pm
(sigh) — Sadly, no. Still dumping header errors before the results when that plug-in is active. :(
106. jason | July 18th, 2008 at 6:27 pm
download link for version 2.6.0.1 is 404!
107. Rob | July 18th, 2008 at 9:34 pm
jason: It seems to be working OK now.
108. Marco | July 20th, 2008 at 12:47 am
Hi, Rob. Great Plugin. Thank you for your good work.
Here is my problem: in my first (main) page i want ‘recent posts’ to show me the next 8 posts (i have 8 per page) so people will have an idea of my previous posts in page 2. Everything works OK, but when i go to previous page (page 2), it shows me the same first posts instead of showing me the next (or previous) posts of page 3. Am i doing something wrong? Thanks in advance.
109. Rob | July 21st, 2008 at 10:31 am
Marco: You’re not doing anything wrong — the plugin doesn’t support that kind of behaviour … but it sounds like a very good idea. I’ll see if I can implement it. Thanks.
110. Marco | July 21st, 2008 at 11:39 am
Thank you for you quick reply. I am sure lots of people would like to see this behaviour included in future versions - i know i would! Nevertheless, all i can say is thank you for your good job and effort.
111. Rob | July 21st, 2008 at 2:29 pm
Marco: I think I can see how to do it unobtrusively so when I have a prototype knocked together I’ll send you some code to try out.
112. Michael Jones | July 22nd, 2008 at 1:35 am
Awesome plugin, I love it.
A quick question - under the filtering options, is there any way to filter out posts which do not have a title? I am thinking it could somehow be done with the custom filter option, but I have been unsuccessful in figuring out how…
113. Rob | July 22nd, 2008 at 10:42 am
Michael Jones: As it stands there is no easy way to catch posts the way you want. You could filter on a custom field if you had one already set up for posts which have no title but that sounds messy.
114. Rob | July 22nd, 2008 at 12:38 pm
Marco: I think the best way of doing what you want is to replace the call to recent_posts in your template with a bit of dynamic code that works out the parameters you want on each page.
So, instead of
<?php recent_posts(); ?>use
Of course this won’t work if you are using the less flexible widget. Let me know if it works for you.
115. Marco | July 22nd, 2008 at 8:19 pm
Rob, thank you for your quick reply and your code. Almost worked!
Now what’s happening is this: first page shows the very same posts of the first page: not working.
From page 2 , etc, it’s working as you expected, showing the next 8 posts of next pages and so on.
You can see it already in (experimental) action in my blog, Portuguese language only, sorry.
116. Rob | July 22nd, 2008 at 9:40 pm
Marco: You found the deliberate mistake! There’s a ‘$’ missing in the code:
if (!ppl_page) $ppl_page = 1;should be
if (!$ppl_page) $ppl_page = 1;117. Marco | July 22nd, 2008 at 9:46 pm
Yes! Working!
Now i finally can say it´s a perfect plugin! ;)
Thank you very much for your help and patience, Rob.
Leave a Comment
Trackback this post | Subscribe to the comments via RSS Feed