AHP Sitewide Recent Posts plugin for WordPress MU

UPDATE: Due to seeming failure of compatibility with the latest versions of WPMU, WPMU Dev has replaced my plugin at their site with their own Recent Posts plugin, which requires their Post Indexer. There’s only an old version at WPMU.org of my plugin now. I am going to rewrite this plugin shortly.

Related: search on AHP at premium WPMU

Building on the venerable Recent Posts plugin by Ron and Andrea, I have created an extended version that offers a lot more user control over output, including gravatar support. The basic features are:

  • excludes posts on main blog (blog ID = 1)
  • excludes first posts (Hello, world) on user blogs (post ID = 1)
  • option to show gravatar support (24px). Gravatar links to posts by user on their blog.
  • option to show post excerpt. User can specify excerpt length with extra argument. Option to capitalize 1st five words of excerpt for readability.
  • option to show post author name
  • option to show post date
  • option to show post comment count
  • all dispay options can be selectively toggled on or off using a single bitmask parameter, permitting very flexible and customizable usage (256 possible configurations!)
  • numerous other display and formatting options can be easily edited in source code using global vars

The argument list:

  • $how_many: how many recent posts are being displayed
  • $how_long: time frame to choose recent posts from (in days)
  • $optmask: bitmask for various display options (default: 255)
    • 1; // gravatar
    • 2; // date
    • 4; // author name
    • 8; // comment count
    • 16; // blog name
    • 32; // post name
    • 64; // post excerpt
    • 128; // excerpt capitalization
  • $exc_size: size of excerpt in words (default: 30)
  • $begin_wrap: start html code (default: <li class=”ahp_recent-posts”>)
  • $end_wrap: end html code to adapt to different themes (default: </li>)

To use the bitmask option, simply add the numeric codes for the display options you want together. For example, suppose you only want gravatar, post name, and date – then the bitmask would be 1+2+32 = 35. Using a bitmask in this way, you can turn on or off any combination of display options above, using only a single function argument.

The latest version of this plugin is at WPMUDEV with a more complete description, installation instructions, screenshot, and sample function call. You can see also see the plugin in action at Talk Islam, under the sidebar section titled “Recent Journals”.

(see update)

screenshot of AHP Recent Posts plugin for WPMU
screenshot of AHP Recent Posts plugin for WPMU

115 thoughts on “AHP Sitewide Recent Posts plugin for WordPress MU”

  1. hello.
    where would I install it? mu-plugins? or can I put it into the plugins folder? And let other blogs use it too? or is it made for the main blog only?

  2. its really intended for use on the main blog, but there’s no reason that a sub-blog couldn’t also use it. The plugin was intended for use in mu-plugins so if its placed there then any blog can make the function call. however you certainly could enable it on a per-blog basis if you prefer.

  3. i have ahp recent post plugin and anarchy media plugin, when add link of video of youtube with anarchy media, the video appears, like excluding the video so that he does not appear in front page?

    with ahp recent posts video no appears but yes one SPACE IN WHITE, like excluding the videos?

  4. my plugin strips out the HTML tags from the post excerpt, so any embedded content will also get stripped out. Its a necessary feature because otherwise the list of recent posts might screw up formatting for the rest of the site. You can edit the plugin to disable the HTML-stripping if you like, it’s on line 181, which currently reads,

    $thiscontent = strip_tags( $thispost[0]->post_content );

    Change that line to read,

    $thiscontent = $thispost[0]->post_content;

    However note that you might be in for some strange output results…

  5. This looks like it could be great but I cant get it to work…what am I missing?

    I uploaded it to mu plugin folder.
    Popped the code <?php ahp_recent_posts_dev(5, 30, 20 , ”, ”,7); ?> onto the template to test it (home.php page)

    I got this…

    Fatal error: Call to undefined function ahp_recent_posts_dev() in /home/****/public_html/wpmu/wp-content/themes/home/home.php on line 36

    What havent I done lol?

  6. you know what? you just caught an error in my plugin documentation. The actual function call should be ahp_recent_posts(); , not ahp_recent_posts_dev();

    Please omit the _dev in your function call and it will work just fine. I apologise. I will correct that error in the documentation at next release.

  7. IT WORKS!! lol Thank you SO much it is just what I wanted! Now a really silly question…. If I want several peoples side by side, or on a grid, can I do that? Or… how can I just put them neater than they are at present.. http://theartnetwork.co.uk/wpmu ? I will be showing about 30 and where they are now, on the front page…

    One last thing.. (sorry) I cane here last night in Firefox and it went on fine, but tonight in Firefox the form to put my name etc disappeared and so I have had to use IE

  8. Its easy to format the function to let you format the display – note that there are arguments for HTML before and after each entry. I usually use list item containers li and /li for these arguments so that the output is formatted as a list. You could also use TD and /TD to format as a table (in fact I need to add an argument that lets you select not just N posts, but an offset.. hmm… ). Then you can use CSS to style the output too. The function is very flexible but maximizing the usage will require you to get down into the details of CSS and HTML etc.

  9. ok totally lost LOL and your li thingies up top dont work, they crashed the page. I will wait until perhaps you or someone can tell me step by step …. Thank you SO much for this though, it is ACE!

    Still cant use comments here in Firefox 🙁

  10. Elizabeth,

    the standard way to use the plugin in your template is as follows:

    <?php ahp_recent_posts(5,30,20,"<li>","</li>",7); ?>

    note that the LI tags have the left and right angle brackets – those are ESSENTIAL. Also the second LI tag has the slash, which is also essential. If you invoke teh function as above, and surround the function call with the UL tags as I have shown above, then you will end up with a nicely formatted HTML list.

    Note, however, that to further customize the output of the function you will need to learn some basic CSS styling. There are plenty of good resources on basic CSS and how to format lists in particular, just google around.

  11. $thiscontent = $thispost[0]->post_content; <– mm no is solution for me.

    other solution? there is no another way to exclude posts or the videos?

  12. wep, i dont understand what you mean, did changing that line not work? was there an error message?

    Ther emay be some conflict with the media plugin you are using I suggest talking to the author of that one since my plugin is not a very complex one and the problem is more likely to be there than here.

  13. without strip_tags sees code in home, front page. i want: NOT post with videos in front page or not some posts in front page.

  14. hello aziz, great plugin work. I’m very interested in using this plugin, but i really need to make it show more than one post per blog. if you give me a hint on how to do it, I can try to do the programming to help you out. This might be a totally new topic, but would it be easy to show the sub blog info within the main blog template rather than within the original blog?
    thanks, Deryk

  15. I don’t understand, i put your plugins to mu-plugins folder and then put your code to my templates but there’s nothing displayed

    <?php ahp_recent_posts(5,30,20,””,””,7); ?>

  16. wep, I dont think you can use this plugin to exclude posts based on the content. It will pick up all posts, whether you embed video or not. Maybe I am still misunderstanding what you are trying to do?

    deryk, that feature is coming, it is on my todo list. It involves modiying the SQL queries. You are free to look at teh source code and suggest a patch for me to integrate if you have time to do so before I get to it. BTW, you can put the function call anywhere you like in your template – i dunno if that answers your second question, if not can you please clarify?

    Johanes, you may simply not have any posts in the last 30 days? Its hard to really guess from the information you’ve provided as to why there is no output. You are not getting a php error, it seems, so it is probably your arguments rather than any error.

  17. Hi Aziz,
    maybe you should check the plugin v0.6 source @ wpmudev.org.
    The function there is indeed called “ahp_recent_posts_dev”.

    thanx for nice plugin anyway

  18. Hi Aziz,
    one more remark… 😉

    there is one little mistake more, which makes your cool script not properly validated. There should be “span class” instead of “span style”, i think.

    //$thisexcerpt = ”.$exc_str
    $thisexcerpt = ”.$exc_str


  19. Greetings and thank you!

    I am wondering though how I can have it return results from the main blog (id=1)? I removed the line; “AND blog_id != ‘1’” and this did work but only returns one result. Any ideas?


  20. buzz,

    argh! ok will need to release another point release version to fix that. If you notice anything else please dont hesitate to drop me an email at apoonawa dash blog at yahoo.


    removing the AND blog_id !== 1 is exactly right, though note if you do this, you might only see one result because the main blog updates more often than the sub-blogs. Also check your function arguments for the time period to see if there were any actual posts from the sub blogs therein or not. Note that this plugin does not show more than one post from each recently updated blog, so you will only see one post from each blog updated within the specified time frame.

  21. question. is there a way to show more than one users recent post? if the user posts 2 times in the same day, can that be called out? also, if a person comments, i noticed the post automatically moves back up to the top.

  22. I fixed the gravatar author link on about line 220

    It did say:
    $thisuser_url = $thisbloglink.”author/”.$thisuser;

    I changed it to:
    $thisuser_url = $blog_link.”author/”.$thisuser;

    and it works great!

  23. tulga, you’re right, that makes more sense (and thanks IdaWebCp for the patch). I’ll release an updated version along with the CSS fix that buzz mentioned above. Also I am debating whether there would be any interest in a non-WPMU, single-WP version of the plugin?

  24. Is there anyway you could show more than 1 recent post per user? Like their 5 most recent posts or something like that?

  25. Does the file name of the downloaded plugin have to remain the same when you upload it into the mu_plugins folder? The downloaded file is called ‘1104069568_ahp_recent_posts_0.6’ and the file extension is ‘.1[1] Document’? The reason I ask is that I cannot get this plugin to word in my WPMU 2.6.3. I also changed the name of the file to ‘ahp_recent_posts’ and still no luck. Have added the default call of ‘<?php ahp_recent_posts(5,30,20,””,””,7); ?>’ into sidebar.php of the template I am using. Then registered a new user, added a couple of posts – can see the actual posts but no Recent Posts lists as expected. Am I missing something? I’m stumped.

  26. Does anyone have any idea why this works for some and not others? Is it simply user error or is there a secret to install it and have it work? OK – we know where it needs to be installed correctly if in the sidebar, we know that posts have to be present (<30 days old) to show up in the plugin, we don’t change the file name as downloaded and it can be placed in either /plugins/ or /mu-plugins/. Anything else?

    Could it be ‘permissions’ (CHMOD) or the way it is uploaded (WS_FTP – auto)?

  27. Hi, aziz

    your plugin is so confusing. I use a simple tag you give
    and all value of variable showing.

    When I add to the code, the excerpt are missing.

    I think it too depend on the css of the theme used.

  28. Its a much needed plugin, thank you! I would like to suggest adding thumbnail support, perhaps pulling the 1st image in the media gallery or custom fields, so that content has pics (more enticing!)

    like this, but using your plugin would be fantastic:

  29. just tried the plugin, seems fine so far, but the gravatar link goes to: h**p://mainblog.com/article/author/sasha instead of to the right user blog, shoud say: user.mainblog.com/article/author/sasha and btw. article is the article name this widget is showing on, bot the original article? thats completely weird…

  30. Works perfectly but is there anyway to have it pull another size Gravatar? The 24px is way to small.

  31. Is there a way to be selective with the posts? for example, In my network there are 7 Blogs that deliver high quality news, and I want only those posts to be displayed. Is that possible?

  32. Hello everyone,

    Thank you for your comments, suggestions, and for your requests. I apoloizse for being tardy on updating the plugin but I am preparing for some overseas travel shortly and will be back mid-January. I intend to release a new version with all the bug fixes above within a week or so of returning.

    Quick answers –

    David Johnson – you can edit the default pixel size for gravatars right in the code, theres a variable defined as $grav_size right near the top. I will see if theres an elegant way to allow you to specify gravatar size as a function argument, but this edit is a pretty easy one to make.

    iamzaks – that is a harder change, because it involves modifying the SQL query. i think i know how to do that but i need to research it before giving you bad code. I will look at that after I get back.

    ovidiu – you’re right thats a bug on my tofix list.

    Steven – that really is beyond the scope of this plugin.

    Chaslie – please use the latets version of the plugin – note that the default function call is much simpler now:

    ahp_recent_posts(5, 30);

    also, it doesnt matter what you call the plugin file, you need not rename it.

    Jake, thats a heavily requested feature but it would require a major change to the sql query. its on y eventual feature list but as you can see there are a lot of smaller fixes that need to get nailed down first.

    Thanks everyone for your feedback and I will attend to the plugin housekeeping when I get back.

  33. One thing I don’t understand, is if I insert an image at the top of the post, when it is pulled to the main blog the text doesn’t show. Any idea why?

  34. Thank you for the response, works beautifully! Quick question, where in the code can I block another post id? I want to block the main one, like it is now, and one other one. Is there a way to do that?

  35. Coming back to say that i got it to work. I know nothing about PHP but it looks pretty logical to me and a quick look through it I spotted the are where I needed to add the code. For anybody else that runs into the problem this what I did.

    I found the place in the code, near the top that says:

    // get a list of blogs in order of most recent update. show only public and nonarchived/spam/mature/deleted $blogs = $wpdb->get_col(“SELECT blog_id FROM $wpdb->blogs WHERE public = ‘1’ AND archived = ‘0’ AND mature = ‘0’ AND spam = ‘0’ AND deleted = ‘0’ AND blog_id != ‘1’ AND last_updated >= DATE_SUB(CURRENT_DATE(), INTERVAL $how_long DAY)ORDER BY last_updated DESC”);

    I added “AND blog_id != ‘7’” without the quotes after the section that begins with delete = ‘0’ AND blog_id != ‘1’

    Hope that makes sense! Enjoy

  36. Where in the plugin can I change $how_many? And what format? like $how_many = 5? Sorry, not too familiar with php. Thanks

  37. Have tried the plugin out. We have a setup where our wordpressmu install is on a subdirectory (/blogs) I have added the code, as mentioned in the comments within the plugin, to my sidebar.php: (ahp_recent_posts(5, 30);. I am running wordpressmu 2.65 using the Paalam theme. When the code is added nothing is added to the sidebar. I see other widgets but nothing is added relating to the plugin. Is there anything else I should try or is this due to the install being on a subdirectory?

  38. Questions: 1) The default 5, is that for $how_many?

    2) Also, I notice right now I think all it does is one recent post per blog, how to change it so it shows the most recent posts regardless of which blog it is from?

  39. I’m finding that the plugin isn’t stripping out all shortcode… in particular code used in the attachment/image uploader eg:[CAPTION ID=”ATTACHMENT_698″ ALIGN=”ALIGNLEFT” WIDTH=”300″ CAPTION=”CAPTION”][/CAPTION]

  40. Hi!
    I made it possible to show lists from fixed category, and also show not only one post but many posts which I want to show, and complete to make as my version.
    Now, I can see 5 posts in ‘news’ category from each blogs, for example.

    Thank you Aziz for your original works!
    It’s really great works!!

  41. the plugin works great but i am having a slight problem…

    the excerpts are not showing in WPMU 2.7…

    is there any solution to this? please help.

  42. i tried AZIZ’s suggestion but the excerpts are still not showing.

    any other work around to this?

  43. Have you figured out how to display most recent posts, regardless of the owner?

    So in other words, even if the last 5 were from the same blog, still list them all…..

    This is much needed – thanks for any help.

  44. Aziz – Great plugin! I am using it for a wpmu installation at work, and it works great. I was wondering if you had a way to paginate the results, or if you were working on adding that functionality at all. My predecessor had a custom script that returned the 300 latest blog posts, but only showed 30 at a time on a page.

    Keep up the awesome work.

  45. Hi,

    Is there a way to show the scrips outside the WPMU folder? How can I use the script on my mainpage (non WP page)?

    Thanks guys!

  46. Great plugin – thanks for all your hardwork.

    Unfortunately, i’m getting a slight error.

    If I include blog name it includes and unwanted / for example: joe blogg/’s

    I’ve tried edited the plugin but I cannot see what would be causing this. Any ideas anyone?

  47. please someone explain where exactly should I put this code?
    Am I doing something wrong? below you can see the part of my home.php file

    WordPress µ
    This is a WordPress Mu powered site.

  48. Is it possible to limit the posts displayed to one blog and one category within that blog?

  49. I don’t see the enclosing in my widget in my theme. I would like ot be able to class that UL as well. What am I misising?

  50. Hey Aziz, can you contact me? I widgetized version 0.32 of this plugin a long time ago, and even added some of the changes you did. However, your version of the plugin looks much much nicer, and I would like to merge my code with yours: I would like to send you a widgetized version of your 0.61 that you can post as an update on wpmudev.org. If you’re not interested in continuing development, maybe you can add me to your wpmudev project or let me manage it. Otherwise, please let me know how to contact you so I can give you my code.

  51. Running into a slight problem.

    Ive uploaded the entire folder to mu-plugins

    Ive uploaded both files to mu-plugins

    No matter how I do it, I keep getting this

    ahp_recent_posts plugin is missing, the widget will not be enabled until the plugin is installed

    So what did I do wrong.

  52. Here is some modded up SQL for including only specific blogs in the query.

    Around line 13, just replace this line which excludes the main blog

    delete = AND blog_id != ‘1′

    With this

    AND blog_id IN (‘2′,’3′,’4’)

    And use the Blog ID for the blogs you want to include, all others not listed will be left out of the plugin’s results.

    Useful if you want to feature/drive traffic to certain blogs.

  53. Make that “around line 131” in the above.

    Also, in case it wasn’t clear, I’m talking about modifying the file “ahp_recent_posts” version 0.6.1, though it may work for others.

  54. Hi there,

    thanks for this nice plugin. Would be possible to show recent posts only of specified blog ID? I mean show recent posts of e.g. blog ID 1 in sidebar and blog ID 2 in footer. Thanks.

  55. Before anything, thank you very much for this great plugin!!

    Now this is my problem:
    I have a blog (id=28) that has many authors, but I would like to show a specific avatar in the excerpt instead of the authors avatar, so that it’s always the same image. (Actually the excerpts from that blog display each author’s avatar, that’s what I want to change).
    Please help me!
    Thank you very much for your time!

  56. I’ve put your code on my site in three locations – not very pretty, but the basic code anyway.

    But instead of any content from the blogs, even though it’s picking up the blogger and the blog address link correctly, the content itself is either the � symbol or a blank box. Clearly I’ve done something wrong. Any idea what?

  57. hi!
    Well, I put this code:

    but text don’t go at the right side of the gravatar…
    how could I do?

  58. Hi Aziz,

    I’m having a little bit of trouble with your plugin.

    The posts are supposed to be sorted from latest to oldest; but I get a few that get misplaced in the order.

    Also I’m not getting the latest post for one of the blogs; I’m getting the second one instead.

    Any idea why?

  59. I have the same issue with one of my blogs showing the second newest post instead of the most recent. Does anyone know why this happens or how to fix it?

  60. Okay I’ve looked into the matter.

    For the “not getting the latest post” bug, in your $thispost SQL query… you should use ORDER BY $blogPostsTable.post_date instead of $blogPostsTable.ID.

    Also about the weird, blog order bug I was experiencing… I guess $wpdb->blogs looks at the last updated activity in the admin area and not just posts.

    But I guess there isn’t an easier way to quickly identify which blog has the latest post, right?

  61. Ray,

    I figured out the issue with the second newest post showing instead of the newest… on mine. The ID numbers had somehow gotten out of sync and the second newest post had a higher ID number than the newest post. The mySQL query in this plugin sorts by ID number. So the highest (in this case, the second newest post) ID number showed.

    You can do one of two things to correct this. Go into PHPmyAdmin and renumber the IDs to have the newest post be the highest number. (Pain in the butt and runs the risk of having this happen again.)
    Or change the mySQL query to order by post_date instead of ID.

    I hope this helps you.

    Now, if I could just figure out how to get more than one post per blog to show….

  62. Darrin,

    I already listed the post_date solution in the comment right above yours.

    Getting more than one post is easy; change “DESC limit 0,1” to “DESC limit 0,x”. Where “x” is the number you want to show.

  63. Ray,

    Sorry I missed that.

    I tried changing to “DESC limit 0,3”, but still just get one post from each blog. I know the mySQL query returns 3 results. I’ve tested it. I must be missing something else.


  64. Hey Darrin,

    I thought changing the limit would allow you to have more posts from the same blog. But I didn’t check it out myself! hehe.

    I get the problem now… Aziz hardcodes $thispost so only the first entry is outputted. eg. $thispost[0].

    What you’d need to do is do a foreach loop after the if($thispost) conditional.


    if(thispost) {
    foreach($thispost as $thePost) {

    Then change all remaining intances of $thispost[0] to $thePost. Make sure you close the foreach loop!

    That should allow you to output more than one post per blog!

    Let me know if that works!

  65. Hmmm…. I had tried that before and it didn’t work. I changed it to:

    foreach ($thispost as $thePost) :

    … do stuff …


    I got an error saying “Cannot use object of type stdClass as array…” Something about it pulling an object as result. I’m not highly proficient at PHP yet, so I haven’t worked out the fix for it.


  66. As pointed out above, the first search gets each blog by the last update activity, which doesn’t necessarily equate to the most recent post.

    I was wondering, could you take the query results for each blog and put them into an array, then sort that array based on the post date and output the values in that method? This way, it wouldn’t matter which blog was updated last, the newest post would be first.

    I’m going to look into it myself and I will post back if I get it to work.

  67. Okay, this is how you do it.

    Get blog list
    Create Array
    Create Counter
    Loop thru blogs
    Get posts (change query to have post_date as first column)
    use $wpdb->get_row($sql, ARRAY_A); where “$sql” is the post query
    insert results into array

    if($thispost) {

    $postArray[$i] = $wpdb->get_row($sql, ARRAY_A);

    sort array
    array_multisort($postArray, SORT_DESC);
    loop through array as before to post the code

    The only issue right now is the blog link, but I’ll probably figure that out soon and then I’ll post a complete example.

  68. Okay, after finishing that little hack, I decided to do a little bit more.
    I wanted to show more than one post per site, so I added the ability to set the limit per site. This doesn’t override the total number of posts seen, but it shows more per site. It still sorts them all by date.

    I did a write up and posted the code.
    AHP Sitewide Recent Posts – hack 2.0

  69. HI,

    what a good plugin, i have implemented it on my wpmu, but is there someone here who can tell me how to makes older post on the bottom of ahp plugin ? so there will be an older post link that show all of the older posting( like 1/2 day before ) . Any help or suggestion is appreciated 🙂 thanks

  70. I figured out out to strip out wordpress’s caption shortcode and make sure that a excerpt is displayed when whitespace precedes the actual text in the excerpt.

    Whitespace became an issue for me when stripping out html and captions from the beginning of the except because the first character encountered was a blank space, causing the script to think that there was no excerpt for a blog post.

    Somewhere around line 242 insert a preg_replace to remove the caption shortcode and a trim() to remove the extra whitespace:

    // get post content and truncate to (numwords) words
    $thiscontent = strip_tags( $thispost[0]->post_content );
    $thiscontent = preg_replace(“/[caption.*[/caption]/”, “”, $thiscontent);
    $thiscontent = trim($thiscontent);
    preg_match(“/([S]+s*){0,$exc_size}/”, $thiscontent, $regs);

    Instead of:

    // get post content and truncate to (numwords) words
    $thiscontent = strip_tags( $thispost[0]->post_content );
    preg_match(“/([S]+s*){0,$exc_size}/”, $thiscontent, $regs);

  71. Thanks for this great plugin, but I didn’t make it work…
    When I wanna active it, there’s an error:
    Cannot redeclare ahp_recent_posts() in ../wp-content/plugins/1104069568_ahp_recent_posts_0.6.1.php on line 90
    ya, it’s plugins, ‘coz when I put it in mu-plugins, the WPMU even can’t find it~
    Please help me, thank you!

  72. alright, it fixed.
    I uploaded the php file both to plugins/ and mu-plugins/, then the function is defined twice….
    sorry …

  73. Is there any code/ or adjustment to make this paginated? Would be awesome to have the ability to show more pages of results.

    Anyone has done this before?

  74. How can I get all the features ahp Recent post offers like: gravatar, date, author name,comment count, blog name, post name, post excerpt, excerpt capitalization to work on my regular Recent Post widgets. I don’t want it from all blogs just single blogs?

  75. Sorry, about only one article . I think I understand..Thank you.
    Will be able to add comments link do?

  76. Hi Aziz

    I have had this plugin installed for awhile now and it was working fine. After a break from working on the site over Christmas, I have came back and found that no matter what I try in editing the arguments, the plugin will only list 1 recent post regardless of the number I list in the code. I am currently using the simplest code to show you what I mean with the latest version of wpmu . . .

    Any thoughts or suggestions would be great.

  77. Please disregard my question. I figured it out by adding a new post to a different blog and it is now showing that post as well.

  78. Thanks for your great plugin – the only trouble I have: how can I disable the html-stripping. In the 0.6.1 version I can’t find the strip_tags …

    thanks werner

  79. Really like the plugin a lot! I did change a few things.
    Order of most recent blog post issue.
    It sorts the list of site by when it was last updated on the master blogs table. Problem with this is a lot of my users update pages on their blogs and not posts as often. So it showed those sites as recently updated. I added some SQL to the query and sorted by Post Date of each blog to get the most recent posts.

    Odd Coding showing in posts
    Stripped out more of the wordpress only captions and such using php. Worked good for my site.

  80. Nice script, but for some reason on my page tekst is always on next line after avatar…

    How to make this tekst showing next after avatar?? Same line with avatar, but on right side after avatar

    Thank you!

  81. Hi!

    We using this plugin in MU…

    witch tables do we have to create for DB (how to change db-config.php) if we are using multi-db plugin???
    Or we don’t need to make any changes???

  82. Dear Aziz, This is a wonderful work done by you. Thanks a lot for sharing this. Is there any way i can get n number of recent posts from a particular blog on my main blog? and if possible n number of posts belonging to a particular category from a particular blog. I wish to have multiple blocks like this on the main blog home page. Please advise…

  83. Is there any way to strip the [caption] out of the excerpt?

    Otherwise, the plugin works great. It’s the best plugin I’ve seen for site like mine that has blogs grouped together.

  84. Hello.
    I’ve been looking around for the shortcode syntax to put this plugin to work on a wordpress site.
    I’m wondering if I’m starting to go blind, cause I can’t seem to find it anywhere. 🙂

  85. Hello all,

    I am about to shortly release v 0.8 which incorporates almost all teh changes and patches suggested above. Thank you to buzz_lightyear (19), IdaWebCo (25), Angelo (59), Ray (72), Alexandria (86) for your help in improving thi splugin! I will post the updated version shortly.

    Note – the plugin does not show multiple posts per user partly by design; this way more prolific authors won’t dominate the output. But technically to implement that you’d need a meta-index of all posts which is not available in the standard WP database, though there is a (not free) plugin called Post Indexer available from WPMU that would let you do that. I prefer the way the plugin works as present and have no plans to introduce multiple posts; I might create an alternate version of the plugin later that uses the meta table from Posts Indexer, but thats lower priority for me right now.

    Dave (38) – thats odd. it may be because the image is counted as part of the xcerpt. I will have to look at that.

    Martin (47) – I think Alexandria (86) solved that problem – I’ve included it.

    Dan (52) – pagination hadnt really ocurred to me, since I never imagined you’d use it for 300 post output 🙂 The output is a simple list right now, so pagination might be prety hard. I’ll have to look into it,, but since thats a pretty extreme use case, i cant promise.

    Mio (53) – you should be able to put the function call anywhere in your theme, not necessarily just the sidebar. You need to be able to edit your theme files, though.

    Will (54) – I’m not exactly sure what you mean. Do you have an apostrophe in that blog name? the escaping might nbe the default behavior.

    Nate (56) and Roman (65) – limiting to just one blog requires editing the SQL query, see comment by Darren #62 above.

    werner (96) and seeley (97) – the part that strips htm is near the end where $thiscontent is defined and theer are calls to preg_replace and strip_tags. you can comment those lines out.

  86. Hello folks,

    I am going to be uploading the latest free version to wordpress.org shortly once my plugin is reviewed by them. This version will be free; however there will also be a paid version ($1) which will include a widget version for simpler installation. The widget version will become significantly more customizable over time than the free version, but core functionality will be the same. I will post links to the versions here once they are up and running.

    stay tuned!

  87. Not sure if you are still work on this or not.

    Anyway, if the comments count portion, you should change the sql query code to prevent SPAM and pingback comments from showing up in the count.

    $thesecomments = $wpdb->get_results(“SELECT comment_ID
    FROM $blogCommentsTable
    WHERE comment_post_ID = $thispostID
    AND comment_approved = 1
    AND comment_type NOT LIKE (‘pingback’)”);

  88. Now wordpress3.0 has merged with the MU, wp3.0 open multi-user mode, you can not use the “AHP-Sitewide-Recent-Posts” plug-in, may I ask how to do? Waiting for your reply.

    1. Hello, I need to update the plugin, but it should still work with merged WPMU. I will look more carefully. Please post any error messages you received.

  89. There is nothing like this plugin. Thank yo so much. I have fixed the [caption] tags problem. Please change the code at around line 242 to this:

    // get post content and truncate to (numwords) words
    $thiscontent = strip_tags( $thispost[0]->post_content );
    $thiscontent = preg_replace(“/\[caption.*\]/”, “”, $thiscontent);
    $thiscontent = trim($thiscontent);
    preg_match(“/([\S]+\s*){0,$exc_size}/”, $thiscontent, $regs);

Comments are closed.