This is yet another theme site, created by Sadish Bala. Visit his WordPress blog at WordPress Rocks

on December 7th, 2004Previous ‘n’ Posts

Updated version 2.0, for WP 2.1. Download it !

On a Permanent Link page, I wanted to display the previous 5 posts.

I searched the WP Community Forum, but couldn’t find one.

Then I got another plugin for Recent Posts , by Nick Momrik and made a copy of that and created a new plugin.

Now I present it to you Previous ‘n’ Posts Plugin.

The Usage is quite simple
<h2>Previous Posts</h2>
<ul>
<?php get_previous_posts(6, ‘<li>’, ‘</li>’, true, $post->post_date,false) ?>
</ul>

Number of posts to be displayed,
‘text to appear before link’,
‘text to appear after link’,
should_show_password_protected_post (true/ false) ?,
date of the current post,
should_show_excerpts_of_the_post (true/false)

Thats it.

Go Ahead and download the Zip file from previous_posts.zip,.
It also includes a ‘readme.txt’ file.
Just save the ‘previous_posts.php’ into your ‘wp-content/plugins’ folder in your WordPress directory and activate it from the Admin Area.

Always use the code from the readme.txt file, and do not copy it from this page.
the code that is shown in this page, is just to let you know how to use it.
Its not the actual code.

Let me know if you have any problems.

Enjoy !

42 Responses to “Previous ‘n’ Posts”

  1. Bengon 08 Dec 2004 at 1:03 pm 1

    I’m using your Previous ‘n’ Posts plugin but the date of the current post is not showing. Please help.

  2. themeporteron 08 Dec 2004 at 5:44 pm 2

    Hi Beng,
    I dont see any problems in your blog. I am already using it in my blogs and I dont seem to get the above mentioned problem.

    Did you do something to cause it / correct it ?

    Thanks

  3. Bengon 09 Dec 2004 at 12:05 pm 3

    Hi Sadish,

    Oh I think I have formulate my question in a wrong way. Actually, I have seen someone using something like this plugin. The only difference was that along with the list of his previous entries, there was also a post date included before the title of each post. Is ist possible for me to do the same? If yes, how shall I do it and which part of the file?

    Btw, many thanks for answering my query and also thank you in advance for the coming reply :)

  4. Bengon 09 Dec 2004 at 12:56 pm 4

    hi, it’s me again. sorry, i am such a bother…but anyways…i found out how to do it.

    greetings from germany!

  5. Carineon 11 Dec 2004 at 4:59 pm 5

    the plugin doesn’t work for me. I’ve inserted that line into index.php. But when I load my blog i get this line:
    Parse error: parse error, unexpected ‘>’ in /home/exileds/public_html/carine/index.php on line 68

    I’m confused what should I do?

  6. ThemePorteron 12 Dec 2004 at 9:45 am 6

    Please do not copy the lines of code from this page.

    Copy it from the readme.txt and use it.

    That should solve the problem.

  7. Andyon 09 Jan 2005 at 6:52 am 7

    Hi,
    Your plugin is good. Is there some way to use it in conjunction with the page-navi plugin? I’d better explain. If I have say 10 posts paged, can the plugin be adapted to show the titles of the 10 previous posts that are not showing on the blog homepage?
    Thanks a lot.
    - Andy

  8. ThemePorteron 09 Jan 2005 at 1:51 pm 8

    Andy,

    Unfortunately, this plugin will not do the ‘next’ n posts. I understand that you are expecting it to that.

    If you need that, I can send you another plugin that does that.

    email to reachme @ simpleinside.com

  9. Defenderon 15 Jan 2005 at 2:14 am 9

    Your plugin does not work in the menu for 1.2.2.

  10. Andyon 15 Jan 2005 at 7:17 am 10

    Perhaps an idea for a new or modified plugin one day after installing your existing ones…
    When posts are paged on the homepage and the plugins previous’n'posts and/or next’n'posts are implemented in the menu, when the reader clicks on a title, the blog will show just the post selected. In the “div” containing the text of the selected post, it would be nice to show before the title a list of the previous n posts and after the text, a list of the next n posts.
    The advantage is to render the titles of previous and next posts more visible as the menu can be considerably longer than the text of the originally selected post.

  11. Sparkleon 22 Jan 2005 at 5:53 pm 11

    I get the same problem as Carrie, and I copied it from the txt file. This character “>” is simply not allowed. Unless it’s in ‘ and ‘.

  12. Sparkleon 22 Jan 2005 at 5:59 pm 12

    Ah, it does allow the date part with this character, >

    But when I copied it from my txt file, the single-quote marks were slanty. So I replaced them with straight ones. It didn’t recognize those as single-quote marks. Therefore my
    gave the error.

    Very strange that it does that.

    It works brillianlty now. Only a couple of minutes of total site shut-down. Heh heh.

    It works on the index AND on the entry pages. Again, brilliant. You should fix the read me file, though. And explain why not to copy from this web page.

  13. ThemePorteron 22 Jan 2005 at 10:11 pm 13

    Yes…

    The Problem is with the single quote character. It gets to a ’slanting’ single quote once u display it on the page.

    I dont know why.

    So till we figure that out,
    1. first copy the code
    2. delete the single quote and put it again on the same place.

    that will fix the problem.

    if any of you know the solution to that, let me know please.

    Thanks.

  14. Johnon 16 May 2005 at 5:54 pm 14

    Your download link does not seem to be working for me, I would really like to try this script and see its versatility firsthand :)

    If you have a copy of this locally I would be grateful if you could email it to me on the email address specified when I filled out this form :)

  15. Theme Porteron 18 May 2005 at 11:04 am 15

    Hey John,

    I updated the link and you can download it now.

    Thanks,
    Sadish

  16. Johnon 18 May 2005 at 12:30 pm 16

    Truely awesome, quickest response to almost anything I’ve had in my life lol. I almost forgot about this until you emailed me ! … Been at it for 3 days downloading and finding new plugins for wordpress (only started the program on sunday) and already I’m interesting in creating my own.

    Hopefully I’ll be able to find out how to write plugins within a few weeks, I guess php and mysql can’t be that tough huh? :o?

    Thanks again for the download link :)
    John

  17. Brianon 15 Jun 2005 at 8:27 am 17

    Hi. Thanks for making this cool and necessary plugin. I installed it on my site, but for some reason am getting a “no more previous posts” message instead of a list of the posts.

    The only thing I modified was to take out the date display. The plugin was activated successfully.

    Here’s what I have: “‘,true,”,false) ?>”

    thanks for any help.

  18. Alexon 07 Jul 2005 at 11:22 am 18

    Nice plugin. Thanks for great job! :)

  19. zoom!on 08 Jan 2006 at 8:34 pm 19

    I’m having the same problem as Alex. I’ve got it installed, but instead of it displaying a list of previous posts, it simply displays “No more previous posts.”

    Input appreciated. Thanks.

  20. Evan Mayon 19 Jan 2006 at 2:31 am 20

    Hello. I installed the plugin, entered the code in the sidebar, and everything looks fine. However, the “recent” posts listed are the most “recent”, but start from a couple of days ago. How can I make it so that the most recent post in the sidebar is the most recent post that was posted?

    http://veritasredux.com

    Thanks,
    Evan

  21. Theme Porteron 19 Jan 2006 at 8:23 am 21

    Even May.

    The Idea of my plugin, is to display ‘Previous Posts’, meaning anything that is not displayed on the front page.

    if you only want the most recent posts to show up, use this plugin.

    http://dev.wp-plugins.org/browser/recent-posts/trunk/

    Thanks
    Sadish.

  22. Evan Mayon 19 Jan 2006 at 1:48 pm 22

    ah. thanks

  23. Jen Lehenyon 17 Feb 2006 at 12:07 am 23

    I have clicked on the links of all the commenters and none of them seem to have this up on their sites. Also you don’t seem to have it on your site either. Does this tell me something? Does it still work?

  24. Theme Porteron 17 Feb 2006 at 12:52 am 24

    Jen Leheny.

    Have you really tried it on your website ? does it not work ? what is your problem ?

  25. four9eron 15 Mar 2006 at 4:09 pm 25

    Hi Sadish, thanks a million for this plugin!

    Had a problem with the slanting single-quote marks, but it works wonderfully now ;p

    Many thanks!

    Jen Leheny, yes it still works ;p I haven’t checked out the other commentators yet, but you can check it out at my site, http://www.xmercenaries.com/four9er

    Cheers!

  26. four9eron 15 Mar 2006 at 4:11 pm 26

    Oh, and it’s on the single post pages, just in case you don’t see it on the main page and was wondering ;p

  27. Chad Dayon 24 Apr 2006 at 3:53 pm 27

    Nothing huge, but I changed this a bit to show posts from a particular category:

    first 10 or so lines of the function:

    function get_previous_posts($no_posts = 5, $before = ”, $after = ”, $show_pass_post = false, $current_post_date=”, $show_excerpts = false, $category_id = false) {
    global $wpdb, $tableposts;
    if (!$category_id) {
    $request = “SELECT ID, post_title, post_excerpt,post_date FROM $tableposts WHERE post_status = ‘publish’ “;
    if(!$show_pass_post) $request .= “AND post_password =” “;
    $request .= “AND post_date

  28. Evron 07 Jun 2006 at 4:47 pm 28

    li tag doesn’t seem to do anything nor does the $post->post_date. Plugin works anyway, thanks :)

  29. Annetteon 08 Aug 2006 at 4:33 am 29

    Hi Sadish,

    Thanks for writing the plug-in. I am using it to display all my previous posts seeing as how I have made the effort to write them. I am still trying to figure out how to make them black.

    I used this date function – gmdate(”Y-m-d H:i:s”,time()) -instead of the – $post->post_date – as I was also getting “No more previous posts.”

    My website is http://www.argentina2alaska.co.uk if you want to check it out.

    Annette

  30. [...] Previous Posts [...]

  31. nickon 06 Dec 2006 at 2:16 pm 31

    link to plugin not working

  32. Sadishon 06 Dec 2006 at 3:53 pm 32

    Thanks nick for pointing out.

    It is fixed now. Try it now.

    Thanks
    Sadish

  33. Mackenzieon 07 Dec 2006 at 11:00 am 33

    This is probably a really stupid question, but how can I style this to make the posts display horizontally (inline) instead of vertically?

    Thanks!
    Mackenzie

  34. Sadishon 07 Dec 2006 at 12:30 pm 34

    try defining a unique id, to the <ul> tag that is used when you call this plugin.
    say <ul id=”recent-posts”>

    and then add this part to the style.css

    ul#recent-posts li {
    display:inline;
    }

    [Please understand that this is not a bug with the plugin, and support for this kind of questions is limited ].

  35. Mackenzieon 07 Dec 2006 at 12:42 pm 35

    Thank you for your reply! I do understand that this isn’t a bug with the plugin, I should have specified that. CSS is a bit new to me and I have been trying to style it in the Stylesheet with no luck. I was hoping there was some formatting in the plugin or something that I was missing :). This didn’t work either but I’ll keep working at it- I’ve been looking for something like this plugin for a long time.

  36. Mackenzieon 07 Dec 2006 at 2:13 pm 36

    After some work I think I’ve gotten it figured out with a little bit of doctoring of the plugin script. Thank you for your help!

  37. [...] Previous ‘n’ Posts (download) [...]

  38. kiaton 07 Jan 2007 at 11:15 am 38

    ur readme file code is not correct,i keep getting syntax error, can you please let me know the exact codes to enter:

    Usage :
    ———

    Previous Posts

    ? ?/li>? true, $post->post_date,false) ?>

    above is what i see from ur readme.txt ….. :(

  39. [...] Ahead and download it [...]

  40. Zhimet cardozoon 30 Jan 2007 at 2:23 am 40

    copied ur code in my templates it seems doesnt work. but im try it with this code :

    Previous Posts

    “, “”, true, $post->post_date,false) ?>

    and its work.. thanks for the code :)

  41. [...] I found the Previous Posts (recently it was updated to work on WP 2.1) plugin by Sadish Balasubramanian. Still, it can only [...]

  42. [...] Previous Posts [...]

Premium WordPress Themes