* about * archives * rails * wordpress plugins coffee2code * * This entry was originally posted Friday, 27 August 2004 and last modified Tuesday, 15 November 2005. Respond via comment <#comments> or trackback * RSS feeds available for posts and comments. * « Patch: Dealing with multiple Miscellenous WP 1.3 development notes/ideas » Plugin: Customizable Post Listings [Notes <#notes>] | [Installation <#installation>] | [Functions <#functions>] | [Examples <#examples>] | [Acknowledgements <#acknowledge>] Name: Customizable Post Listings Author: Scott Reilly Version: 1.1 Last updated: 27 September 2004 Download: [ zip ] | [ view source (.phps) ] Description: Display Recent Posts, Recently Commented Posts, Recently Modified Posts, Random Posts, and other post listings using the post information of your choosing in an easily customizable manner. You can narrow post searches by specifying categories and/or authors, among other things. Notes: List of percent substitution tags supported: %comments_count% // Number of comments for post %comments_fancy% // Fancy reporting of comments: (see get_recent_tagmap()) %comments_url% // URL to top of comments section for post %comments_URL% // Post title linked to the top of the comments section on post's permalink page %last_comment_date% // Date of last comment for post %last_comment_id% // ID for last comment for post %last_comment_URL% // URL to most recent comment for post %last_commenter% // Author of last comment for post %last_commenter_URL // Linked (if author URL provided) of author of last comment for post %post_author% // Author for post %post_author_count% // Number of posts made by post author %post_author_posts% // Link to page of all of post author's posts %post_author_url% // Linked (if URL provided) name of post author %post_content% // Full content of the post %post_date% // Date for post %post_excerpt% // Excerpt for post %post_excerpt_short% // Customizably shorter excerpt, suitable for sidebar usage %post_id% // ID for post %post_modified% // Last modified date for post %post_title% // Title for post %post_url% // URL for post %post_URL% // Post title linked to post's permalink page Installation: 1. Download the file customizable-post-listings.zip and unzip it into your /wp-content/plugins/ directory. -OR- Copy and paste the the code ( customizable-post-listings.phps ) into a file called customizable-post-listings.php, and put that file into your /wp-content/plugins/ directory. /Please ensure you do not introduce any spaces or other characters before the / 2. Optional: Change configuration options in the file to your liking. In-code comments should help you there. 3. Activate the plugin from your WordPress admin 'Plugins' page. 4. Include one or more of the templates defined below into a template file (most likely sidebar.php) Functions: function c2c_get_recent_posts ($num_posts = 5, $format = "
  • %post_date%: %post_URL%
  • ", $categories = '', $orderby = 'date', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false) function c2c_get_random_posts($num_posts = 5, $format = "
  • %post_date%: %post_URL%
  • ", $categories = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false) function c2c_get_recently_commented ($num_posts = 5, $format = "
  • %comments_URL%
    %last_comment_date%
    %comments_fancy%
  • ", $categories = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y h:i a', $authors = '', $include_passworded_posts = false) function c2c_get_recently_modified ($num_posts = 5, $format = "
  • %post_URL%
    Updated: %post_modified%
  • ", $categories = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false) * $num_posts : The number of posts to return; default is 5 * $format : A string that uses percent substitution tags to define the data you want displayed for each listing and how you want it displayed;set it to '' (two single-quotes) to return an array of the requested post objects without outputting anything. * $categories : A space separated list of category IDs to match against; leave empty to consider posts from any category * $order : The order with which the post listing should be sorted, either 'ASC' (for ascending) or 'DESC' (for descending); default is 'DESC' * $offset : The number of posts to skip; default is 0 * $date_format : Date format string, PHP-style, if different from the blog's default date-format string * $authors : A space separated list of author IDs to match against; leave empty to consider posts from any blog author * $include_passworded_posts : A boolean value, either 'true' or 'false', indicating if passworded posts should be considered in the post search Tips & Examples: The "Recent" listings on the sidebar of this site all use this plugin. The simplest examples would be the following (for brevity's sake, in the examples I'm going to specify 3 as the number of posts I want returned):
      Recent Posts
    Would output something like: * Recent Posts 08/03/2004: Patch: Dealing with multiple * 08/03/2004: Patch: Balancing pre-'more' tags * 08/03/2004: Patch: Fixing balanceTags() ------------------------------------------------------------------------
      Recently Commented
    Would output something like: * Recently Commented Plugin: Category Image(s) 08/23/2004 10:25 am 14 Comments * Plugin: Get Custom Field Values 08/22/2004 04:35 pm 18 Comments * Plugin: wpPHPMailer 08/16/2004 01:15 am 11 Comments ------------------------------------------------------------------------
      Recently Updated
    Would output something like: * Recently Updated Plugin: Get Custom Field Values Updated: 08/22/2004 * Plugin: wpPHPMailer Updated: 08/17/2004 * Plugin: Hide or Cut Post Text Updated: 08/17/2004 ------------------------------------------------------------------------ But what you may really want is to run the Recent Posts/Recently Commented Posts/Recently Updated Posts/Random Posts calls and customize the listing output. That's where the percent substitution tags come into play. The second argument to each of the three functions above is the $format argument. $format is a string that represents how each post found by the function should be output. Any percent tags (as listed and defined above) will be replaced with the appropriate data. So, let's say you want a list of recent posts, to include the post author's name linked to the archive of all of that author's posts, plus a short excerpt of the post. And let's say you only want posts from category '34′. You'd do this:
      %post_date%: %post_URL%
      by: %post_author_posts%
      %post_excerpt_short%", "34"); ?>
    Which would output something like: * 07/25/2004: Plugin: Hide or Cut Post Text by: Scott I'm pleased to announce the release… * 07/08/2004: Plugin: Random File by: Scott I just finished the final touches… * 07/08/2004: Plugin: Auto-hyperlink URLs by: Scott Finally, I managed to tackle a… Release Log: * 27 Sep 2004 : v1.2 – o Added the ability to get random posts, and added the convenience function |c2c_get_random_posts()| to get them o Functions will now consider sticky posts (those in which 'post_status' gets set to 'sticky') in addition to published posts o Changed license from BSD-new to MIT * 05 Sep 2004 : v1.02 — Bugfix to immediately return if no posts match criteria * 03 Sep 2004 : v1.01 — Bugfix for when |$authors| has more than one author * 27 Aug 2004 : v1.0 — Released to the public Copyright & Disclaimer: Copyright (c) 2004 by Scott Reilly (aka coffee2code) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Acknowledgements: N/A 229 Responses to “Plugin: Customizable Post Listings” 1. Jonas replied on August 31st, 2004 at 6:30 AM EST <#comment-142> This looks very promising ! I already started using it to generate title lists. Where would I toggle a "delimit to last 7 days" function , similar to this Mysql string " between date_add(current_date, interval -7 day) and date_add(current_date, interval 1 day) " ? All hints are warmly welcomed ! Best Regards Jonas / Germany 2. bookmarks replied on August 31st, 2004 at 10:00 AM EST <#comment-143> ** customizable post listings plugin 3. Scott replied on August 31st, 2004 at 6:20 PM EST <#comment-144> *Jonas:* Well, as it stands now the plugin doesn't directly support specifying a date range. I'll consider such a feature for a future version. I'm open to suggestions, though. 4. Ian replied on September 2nd, 2004 at 4:51 AM EST <#comment-145> Is there a quick way to exclude a single category, or will I have to list all the categories IDs that I want to show? Either way it is just about what I am looking for. 5. Scott replied on September 2nd, 2004 at 8:11 AM EST <#comment-146> Category exclusions is trickier business, but I have a plan in mind on how to go about doing it. Should be part of the next release for this plugin, but I can't quote you a date on that. For now, yeah, you'd have to explicitly list all the categories you want. 6. Trevor replied on September 3rd, 2004 at 7:58 AM EST <#comment-149> Everything seems to work as described except when I try to use $authors, which produces the following error: Warning: Invalid argument supplied for foreach() in /blah/blah/blah/wp-content/plugins/customizable-post-listings.php on line 76 |Database error: [You have an error in your SQL syntax near ') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 1, 5' at line 1] SELECT DISTINCT * FROM wp_posts WHERE wp_posts.post_date <= '2004-09-03 14:49:04' AND wp_posts.post_status = 'publish' AND wp_posts.post_password = '' AND ( ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 1, 5| 7. Scott replied on September 3rd, 2004 at 8:27 AM EST <#comment-151> Found the problem. Try grabbing the plugin again, version 1.01, and let me know if that one works for you. Thanks for the problem report! 8. Trevor replied on September 3rd, 2004 at 9:13 AM EST <#comment-152> Thanks, but doesn't seem to do the trick. Tried 1.01 and, using (1, "%post_URL% %post_excerpt_short%", "", "date", "DESC", 0, "m/d/Y", "1″, false), now get: Warning: Invalid argument supplied for foreach() in /blah/blah/blah/wp-content/plugins/customizable-post-listings.php on line 76 |Database error: [You have an error in your SQL syntax near ') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 1' at line 1] SELECT DISTINCT * FROM wp_posts WHERE wp_posts.post_date <= '2004-09-03 16:05:05' AND wp_posts.post_status = 'publish' AND wp_posts.post_password = '' AND ( ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 1 Warning: Invalid argument supplied for foreach() in //blah/blah//wp-content/plugins/customizable-post-listings.php on line 140| 9. Trevor replied on September 3rd, 2004 at 9:18 AM EST <#comment-153> Sorry, gives foreach() error on line 140 as well as 76 10. Scott replied on September 3rd, 2004 at 5:11 PM EST <#comment-154> Hmm, it seems to work for me trying what you indicated. It's almost as if the function isn't seeing the value of $authors. (The second bug being reported on line 140 is a result of the first bug, and trivial to fix.) You are calling the |c2c_get_recent_posts()| function, or one of the other two? Would you be up for me suggesting some debugging suggestions (or I could send you some debugging versions of the plugin) to try to track down the problem? 11. Trevor replied on September 3rd, 2004 at 5:50 PM EST <#comment-155> Yep, using c2c_get_recent_posts(). Re debugging: glad to do whatever you think might help 12. mikey replied on September 4th, 2004 at 2:01 AM EST <#comment-156> I am using the sticky posts hack and due to this I get this error for the comment part. *Warning*: Invalid argument supplied for foreach() in *c:\sites\single1\easydoesit\webroot\wp-content\plugins\customizable-post-listings.php* on line *140* I'm sure Ill get this when my lates post becomes a sticky too. Do you have a way to get around this because I really want this plugin on my site. 13. mikey replied on September 4th, 2004 at 6:58 PM EST <#comment-158> OK so I figured it out. You have the line: |$sql .= "WHERE $tableposts.post_date <= '$now' AND $tableposts.post_status = 'publish' ";| which of course insures that it only looks for published posts but I have a value that is 'sticky' in my post_status field. I changed the line to: |$sql .= "WHERE $tableposts.post_date <= '$now' AND $tableposts.post_status != 'draft' AND $tableposts.post_status != 'static' AND $tableposts.post_status != 'private'";| so that it would look at the 'publish' and 'sticky' posts. I originally tried: |$sql .= "WHERE $tableposts.post_date <= '$now' AND $tableposts.post_status = 'publish' OR $tableposts.post_status = 'sticky' ";| but this caused wacky extra not commented posts. I don't know why as I'm not a programmer. Anyways thats how I fixed it. 14. Scott replied on September 5th, 2004 at 9:59 AM EST <#comment-159> First off, I have updated the plugin with a slight tweak, so it is now up to version 1.02. *Trevor:* If you are comfortable with modifying the plugin code for debugging purposes, obtain the latest and where you see this line: $auths = explode(' ', $authors); Add a line before and two after it so it looks like this: echo "authors = ($authors)
    "; $auths = explode(' ', $authors); echo "auths ( "; print_r($auths); echo " )
    "; echo "is_array? (".is_array($auths).")
    "; Let me know what it says for your site. 15. Scott replied on September 5th, 2004 at 10:10 AM EST <#comment-160> *mikey:* What you tried initially would probably have worked if you added parentheses like so: $sql .= "WHERE $tableposts.post_date <= '$now' AND ( $tableposts.post_status = 'publish' OR $tableposts.post_status = 'sticky' ) "; I am considering the addition of this change to the plugin. Thanks for reporting the issue and finding the fix! 16. Trevor replied on September 6th, 2004 at 12:19 PM EST <#comment-162> Thanks Scott. Now there is no error message and, with author ID=1 selected, posts for all authors are displayed, prefixed by: authors = (1) auths ( Array ( [0] => 1 ) ) is_array? (1) 17. beth replied on September 9th, 2004 at 6:30 AM EST <#comment-175> Please excuse me if I am being totally dumb here but is there a way that I can fix the dates into a UK format? I have my blog set to display dates in the way that we are used to nd I would like my recent lists to display day before month if at all possible Thanks Beth 18. Scott replied on September 9th, 2004 at 9:04 AM EST <#comment-177> *Beth:* You can send the date format as one of the arguments to the function. The date format you want, i.e. 31/08/2004 (Aug 31, 2004), is achieved through the date format of 'd/m/Y'. You would use that like so: %post_date%: %post_URL%", '', 'date', 'DESC', 0, 'd/m/Y'); ?> (you have to explicitly define all the arguments before the |$date_format| argument) Or, alternatively, you could change the default value for the |$date_format| argument for each of the three functions by modifying the plugin file. Which, if you do, you should make note of so that in the event you upgrade the plugin you know what you need to change again (since upgrading will overwrite the plugin file). 19. Josh Jarmin replied on September 11th, 2004 at 12:35 AM EST <#comment-181> Is there a way to limit the posts and the excerpts to a certain number of words? I would like to use this but I am looking for this feature. Thanks! 20. Scott replied on September 11th, 2004 at 1:17 AM EST <#comment-182> *Josh:* Yes, but you have to change a value within the plugin file itself. Look for these lines in the function c2c_get_recent_tagmap(): | //-- Some things you might want to configure ---– $excerpt_words = 6; // Number of words to use for %post_excerpt_short% $excerpt_length = 50; // Number of characters to use for %post_excerpt_short%, only used if $excerpt_words is 0 | Modify those to your liking. Keep in mind that in the format string you'll want to use %post_excerpt_short%, which will honor the above settings, as opposed to %post_excerpt% which is the user- or WP- generated excerpt. Like the code commenting says, if you want to limit by number of words, change the value of |$excerpt_words| to something else if the default of 6 doesn't suit you. Or it you want the excerpt to be limited by number of characters, change |$excerpt_words| to 0 and change the value of |$excerpt_length|. Does that accomplish what you need? 21. Trevor replied on September 11th, 2004 at 7:12 AM EST <#comment-183> Scott, any further suggestions re the feedback I gave on Monday? 22. poper replied on September 15th, 2004 at 12:12 PM EST <#comment-184> Hi, Scott, another great plugin. I wonder if it's possible to use a substitution tag in order to show the name of the category the post belong to, I mean, an output similar to this: * Personal: post_title … * Software: post titlel etc Thanks 23. Trevor replied on September 15th, 2004 at 1:47 PM EST <#comment-186> OK, the author selector seems to work as long as ID doesn't equal 1. Wonder why that is… 24. Scott replied on September 16th, 2004 at 12:53 AM EST <#comment-188> *Trevor:* Sorry to have taken so long to follow up with you. On a test blog I tried to recreate your problem but have so far been unsuccessful. I had a second author (with the most recent overall post), and when I indicated I only wanted posts for author '1′, the post for author '2′ got skipped. If I didn't specify an author, all posts were considered. And after examing the code, I can't see a reason why it wouldn't work like it's supposed to. I'll keep looking at it, but so far I'm coming up empty on it. *poper:* I'll add some sort of category substitution tag in the next release. 25. Matt replied on September 16th, 2004 at 4:13 PM EST <#comment-189> is there anyway I could get this to grab a random post from a category instead of the latest post? 26. Beth replied on September 17th, 2004 at 5:14 AM EST <#comment-190> Thanks Scott. The date problem was easily fixed when I was feeling more alert. Sorry to have been stupid about it - blame Plugin Overload. :-) I list all the recent days posts on my blog so really would like the Recent list to list the previous n posts on days!=today. Can that be done? Thanks Beth 27. Scott replied on September 17th, 2004 at 7:28 PM EST <#comment-191> *Matt:* Thanks for the suggestion. I will include the ability to get random posts in the next release, which should be within the next few days. *Beth:* Currently the plugin only supports skipping N posts and not posts from the last N days (where for your scenario N would be 1). Unless, of course, you only posted a certain number of posts per day or something. Otherwise, I'll contemplate a way to honor the request, though no guarentees. 28. tom replied on September 18th, 2004 at 10:54 AM EST <#comment-193> great plugin scott, i'm just going to implement it on a site. using the most recent posts function, is there an easy way of only printing the date once, so you get a date, followed by all of the posts under that date, without printing another date until all of the posts for that date have been printed, and it is on to another date? eg: 19/10/2004: Random Post 1 Random Post 2 Random Post 3 18/10/2004: Random Post 4 Random Post 5 etc. ? 29. littleman09z replied on September 18th, 2004 at 6:05 PM EST <#comment-194> Hey, I just installed your plugin(nice!) there was only one problem…I put in the recenty posts ,recently commented, and recently updated. The recent posts and recently commented worked fun but recently updated did not work at all and said function not found( i think) i browsed through the comments here and didnt see anything.. so i decided to go view your code..thinkin that it cant be that bad..and i found that you didnt have |
      Recently Updated c2c_get_recently_updated(3); ?>
    | as a variable…and i saw one that said / modified / instead of / updated / so i changed updated to modifiend so it looked like |
      Recently Updated
    | instead and it worked fine! 30. Beth replied on September 19th, 2004 at 8:52 AM EST <#comment-197> Thank you Scott. I've been looking at the code to see if I can modify it to meet a request from my users but a dunce like me needs significantly more comments in the code before attempting such ambition. My users would like a single list of recently updated/added material so that new posts, edited posts, AND commented posts all appear in the one list. I'm trying to make get_recently_modified to do the trick for me and failing miserably. I *think* what my users want to see is a single list that would give: Post Subject with link, Number of Comments - may be zero if new post - with link to most recent comment, and Author/Date/Time of the post/comment most recently added or edited. I said I would try but it seems beyond me. Can you offer any pointers on where to modify the code in order to get a single list? Thanks 31. Scott replied on September 19th, 2004 at 9:43 AM EST <#comment-198> *tom:* I'll consider your suggestion. There would be a number of changes necessary to accomplish what you ask, and I'm trying to be mindful of maintaining a balance of ease-of-use and complexity. *littleman09z:* Oops, thanks for that catch. You're right, the examples section referred to the non-existant |c2c_get_recently_updated|. As you figured out, the function I meant to write (and have now fixed) was |c2c_get_recently_modified|. *Beth:* Take a look at the sidebar and you'll see a "For Beth" section (this'll be temporary). It is a recently_modified listing that includes information about each listed post's most recent comment/commenter. Granted, it should be more pleasing about reporting non-existent comments. The command to get that list was: |%post_URL% (%comments_count%)
    Last comment: %last_commenter% at %last_comment_date%'); ?>| I could probably add a percent-substitution tag to repesent a link of the last_commenter's name linked to the comment, and a link of the last comment date to the last comment. A greater degree of difficulty is added if you want to order the listing based on both the recently-commented dates and recently-modified dates (new posts are considered as being recently modified). 32. Brian Rose replied on September 20th, 2004 at 12:33 AM EST <#comment-201> Excellent plugin! I hit one little snag while installing that, hopefully, will have a quick solution: I need to exlcude category nine (as it is my miniblog) from the 'Recent Entries' section of my new design. I'm using the following bit of code: |<?php c2c_get_recent_posts(4, "<dd>%post_URL%</dd>\n", '1,3,4,5,6,7,8', 'date', 'DESC', 1); ?>| It seems that, in doing so, the posts no longer sort by date - they sort by category, then date. Most of my entries are in categories one and eight and those in category eight are not even being included in the sort. Any ideas? Thanks in advance. 33. Timothy B replied on September 22nd, 2004 at 12:18 AM EST <#comment-218> Thanks for a groovy code!! It took a little fiddling but I was able to use it to post the most recent posts in my "Take Action!" Category on the site. There was a problem at first when I tried to make a post be sticky using another script ( I wasn't able to make a post sticky AND show up under the most recently posted in a particular category..) but I will take what I can get! Thanks again! =) 34. Scott replied on September 27th, 2004 at 12:28 AM EST <#comment-235> *Plugin updated to v1.1* This release features these changes: * Added the ability to get random posts, and added the convenience function |c2c_get_random_posts()| to get them * Functions will now consider sticky posts (those in which 'post_status' gets set to 'sticky') in addition to published posts * Changed license from BSD-new to MIT 35. Tyrone replied on September 27th, 2004 at 6:30 PM EST <#comment-236> The plugin appears to fumble with ampersands in the permalink's title tag For instance, if the post title is "Jack & Jill" the link title will show |Jack &amp; Jill|. This results in problems with all html entities, especially the more likely to be used single quotes & double quotes. I read in the wordpress forums that previous versions of wordpress had these problems, while version 1.2 mingus and up do not. I edited version 1.1 of your plugin on line 262 changing this: |title="View post '.htmlspecialchars(strip_tags($title)).'"| to this: |title="View post '.$title.'"| This appears to have solved the problem. The html character entities are now being encoded properly into their hex equivalents minus the ampersand problem. I hope the htmlspecialchars section didn't have any further particular significance I'm unaware of? It's a minor problem solved, which makes this an invaluable plugin. I was using a get recent posts "hack" found in the wordpress wiki, but it performed a query for each post retrieved, so if I wanted to retrieve the last 15 posts (offset by 5) it would perform 15 queries. Your version is much faster and only executes a single query. 36. Tyrone replied on September 27th, 2004 at 9:11 PM EST <#comment-237> Scott, I have an suggestion for a feature regarding *c2c_get_recent_posts*. Let's say I'm viewing the single/permalink page of a "recent" entry and I'm showing the last 5 recent entries in the sidebar. It would be nice if the recent entries list excluded the permalink page I'm currently viewing from the list. It's unnecessary to display that particular recent entry link it if I'm currently on that page. Just something to think about. 37. Lawrence replied on October 8th, 2004 at 11:40 AM EST <#comment-242> Hi, how can I edit this plugin to get a list of most read posts (popular posts). 38. Scott replied on October 10th, 2004 at 9:56 AM EST <#comment-246> *Tyrone:* Thanks for pointing out the issue regarding the use of |htmlspecialchars()|. I'll go back and review why I put it there in the first place and verify that it needs taking out. Also, thanks for your other suggestion; I'll give it some consideration. *Lawrence:* WordPress doesn't keep track of when/how often posts get read, so that information isn't readily available to this plugin. There are plugins that allow you to keep track of that information. I'm not familiar with how they're designed. Unless they are designed in a very specific way (by adding visitor counts to a new column in the wp_posts table) it is unlikely you can use this plugin without modification to take advantage of that data. Otherwise, you'll either have to use another plugin for all your "most popular posts" needs, or modify this plugin to take advantage of the info the other plugin has recorded. 39. Nikki replied on October 11th, 2004 at 9:29 AM EST <#comment-248> I'm running a photolog, and wanted the previous 4 entries as thumbnails just below. I downloaded your plugin, set the offset to 1 in the file and then used this: |%post_excerpt%'); ?>| Thank you an incredible amount. This SO rocks. Why didn't I find it sooner?! 40. fernando_graphicos replied on October 11th, 2004 at 2:54 PM EST <#comment-249> wow… thank you for this killer update to your already very useful plugins. when you said you "might look into it…" i crossed my fingers, but i bet nobody expected such a comprehensive, well documented, update. awesome. thank you. 41. william replied on October 13th, 2004 at 1:15 PM EST <#comment-251> Thanks for the great work… it's a rock'n plugin. 42. amory replied on October 17th, 2004 at 12:21 AM EST <#comment-255> i'm having trouble displaying the recent posts from a certain category. the code i've tried: | | photography is a category and there are sufficient posts in it… 43. IDahoCline.com's Blog » Soon server migration and few new features added replied on October 19th, 2004 at 10:51 AM EST <#comment-259> […] info, craft.idahocline.info, gallery.idahocline.info Some new internal stuffs (plugins as Customizable post listing , Category images and … e you so […] 44. War_Pigs Pen replied on October 19th, 2004 at 11:12 PM EST <#comment-262> *Take control of your Posts* I have begun to use the coffee2code.com plugin Customizable Post Listings. So far its impressive for its size. Does exactly what I want it to do at this stage and it easy to use. 45. War_Pigs Pen » More to Tidbits replied on October 22nd, 2004 at 12:14 AM EST <#comment-266> […] shot though. (1) Take control of your Posts I have begun to use the coffee2code.com plugin Customizable Post Listings . So far its impressive for its size […] 46. War_Pigs Pen » More to Tidbits replied on October 22nd, 2004 at 12:14 AM EST <#comment-267> […] shot though. (1) Take control of your Posts I have begun to use the coffee2code.com plugin Customizable Post Listings . So far its impressive for its size […] 47. Paul Hoch replied on October 23rd, 2004 at 9:21 PM EST <#comment-268> It might be interesting to add the ability to get the active plugins. I've been messing around a bit and I'm just not good enough to make it work. It seems to me that the only table that contains that info is wp_options under 'active_plugins' but I don't know if it's possible to get more info about the plugin itself - url, author, etc from the sqldb. Even so, it would be cool to add the ability to show which plugins are active. Thanks for the great tool! 48. Stefan Liden replied on October 26th, 2004 at 7:32 AM EST <#comment-269> Wonderful plugin! Do you know if there is a way to display thumbnail previews that were added through the Exhibit Engine plugin when showing content? Thank you for a great plugin. 49. oculos replied on October 26th, 2004 at 9:57 AM EST <#comment-270> Hello Scott! Wow, wonderful plugin! Thanks a lot! I wonder if it could be implemented a %comment_excerpt_short% tag! It would be nice to display the beggining of the comments on the side bar! Keep on the great work!! Cheers, oculos 50. Tin replied on October 27th, 2004 at 3:15 PM EST <#comment-275> hi scott! a few months ago i asked for something like this. now you've made this! it works great! thanks for all your efforts. i have one question. it seems that your plugin is the only one i know of its kind that can pull up all of the entries by one author. do you know how i can embed this into the loop? for example, i have a photoblog of multiple authors on my site. the photographer (or author) of each post is included at the end of each entry (within the loop). is it possible to make it so that if i click on the author's name, it brings up all the entries by that author and filter out all the other authors? wordpress has a author_post_link, but that only brings up the most recent entries. 51. Gede Wijaya replied on November 2nd, 2004 at 10:41 AM EST <#comment-278> Great plugin. Thank you very much! But I have some problem. With function: |: %post_URL%
    by: %post_author_posts%",'','date','DESC','10','d F Y',''); ?>| In database table wp_users, the authors that didn't have "user_nicename" column, will not show up their URL. Instead, will show something like: http://some.site.com/berita/arsip/author// for, example, user with ID =7 How do geet I show those author that didn't have nice name? is it my blog configuration? 52. Mi replied on November 5th, 2004 at 1:46 AM EST <#comment-281> I don't know if anyone else have had this problem with the recent version, but it screws up the header informations in wp-login.php saying that the headers were already sent by the plugin. Any say on this? 53. ColdForged replied on November 5th, 2004 at 12:12 PM EST <#comment-282> Excellent plugin. I had written my own to do similar things, but with some added functionality. I've since modified yours to add the functionality I desired. You are welcome to roll these mods in if you wish. * Added support for excluding categories. As in the rest of WordPress, simply provide a list of negative categories separated by commas (e.g. '-27,-28′) for the $categories parameter. * Added support for listing of post categories as well as links to category archives (with customizable delimiter). * Added support for links to comments section for fancy comments. Hopefully someone will find it useful. To see them in action, hit the website link above: the sidebar displays the 5 most recent entries that aren't in my 'Asides' or 'Currently' categories and the bottom of the index uses new category links and fancy comment links. Here's a link to the updated code. Thanks again for the good code to add on to. 54. ColdForged replied on November 5th, 2004 at 12:23 PM EST <#comment-283> Of course, error in original code in the titles of the comment links. Here's the updated code . 55. Scott replied on November 5th, 2004 at 12:34 PM EST <#comment-284> First off, thanks everyone for the kind words. Now on to the answers: *amory*: There are two things you would need to address in the examples you provided. The second argument lets the plugin know how to output the text from the posts once it has found them (i.e. did you want to show the post's date, content, excerpt, etc). The third argument is where you specify the category(ies). But instead of using the category name you have to use the category id (you can find the category id in the "categories" page of the admin section of your blog). Assuming photography had an id of 3, here is an example to list the post titles of the 5 most recent posts in the photography category: |
      %post_URL%", '5'); ?>| *Paul Hoch*: You might want to check out the Plugins Used plugin, which allows you to display info about the plugins driving your blog. *Stefan Liden*: I haven't looked at Exhibit Engine so I can't say what is involved in adding thumbnails from it as a percent substitution string, but I'll keep it in mind for possible future inclusion. *oculos*: Great suggestion! I'll see about including it in the next version of the plugin. *Tin*: I'll have to take a look at the WP code to see if there are already provisions to do what you want. My guess is that WP allows for what you want. *Gede Wijaya*: I'll have to look into your issue farther. As far as I know, the user_nicename database field is supposed to be auto-generated by WP. If it isn't, I'll have to take it into account in a subsequent release of this plugin. *Mi*: Getting errors about header information already being sent is usually a result of the plugin file having a space or other characters before the || at the end of the file. 56. Scott replied on November 5th, 2004 at 12:49 PM EST <#comment-285> *ColdForged*: Thanks for the code contribution! I haven't had a chance to look at the code yet, but it sounds like you've addressed some of the areas I've targeted for future releases. I'll definitely credit you for whatever code I use. I'm curious to see how you did category exclusions; it's been awhile, but I recall there seeming to be something tricky about it… maybe it was my SQL skillz weren't good enough to construct a single query to simultaneously handle category inclusions and exclusions. 57. ColdForged replied on November 5th, 2004 at 12:54 PM EST <#comment-286> You're welcome. Take a gander… I essentially reused the ideas from the WordPress exclusion code. I'm still working on things… this is a very fresh project (this morning) as I add functionality like the Asides to my site. Hence, it's sort of a moving target. I've already added another replacement (%comment_number_url%) and I'm now returned the actual number of posts returned so that people that need to know that can get that information easily. Again, nice plugin… saved me some work! 58. ColdForged replied on November 5th, 2004 at 1:09 PM EST <#comment-287> Another thing you may want to think about… the way you're handling %post_content% using the "apply_filters" causes the content to always be surrounded by paragraph tags. If you instead use: |$new = wptexturize($post->post_content);| It'll apply the filters but not surround it in paragraph tags. The tags are problematic in an "asides" situation where you want the content inline. Just a thought. 59. ColdForged replied on November 5th, 2004 at 4:54 PM EST <#comment-291> Latest additions available here . 60. paul replied on November 7th, 2004 at 10:47 AM EST <#comment-293> Hi, I love your plug in, but am having a slight problem. I am trying to display most recent posts (without dates), most recent comments & most commented. In your blog these all seem to lay out consistently, i.e. there is the same amount of space between the title 'most recent posts' and the content below it, as there is between 'links' and the stuff below it. On mine this does not happen - there is no space beneath 'most recent posts' etc. Also, while everything looks consistent in internet explorer, in every other browser, the title text i.e. 'most recent posts' displays in a different font, at a different size, in a different colour and the text below it keeps the style sheet style, but displays without the same indent. Any suggestions??? 61. Mi replied on November 8th, 2004 at 5:09 AM EST <#comment-294> Thanks, Scott! I didn't realize I had whitespace. It's working like a charm now~ 62. ColdForged replied on November 8th, 2004 at 2:45 PM EST <#comment-295> I'm curious to see how you did category exclusions… To be honest, I only tested it with a single exclusion. When I went to add the second exclusion is when the problems cropped up :) . Updated to handled multiple exclusions. Note that to really support multiple exclusions at the core "loop" level, the core code has to change too. The file "classes.php" has the handling for constructing the appropriate select statement, and that has to be tweaked a bit. I had to do this because — as of today — I have two categories that are meant to be "out of the loop": the asides and a "currently reading" category. As of now the code handles it fine. You can see it in action at my homepage : the currently reading section in the sidebar, the "Last Five Entries" in the sidebar, the "asides" sections between main posts and the "More Recent Entries" at the bottom of the main page all use the c2c…() function with inclusions and exclusions. Latest code with working exclusions is here . 63. ColdForged replied on November 8th, 2004 at 2:48 PM EST <#comment-296> Paul, Any way you could provide a link? This almost certainly sounds like a CSS issue. This plugin merely outputs the information extracted from the database in whatever format you specify. It's up to your CSS to style it appropriately. 64. ColdForged replied on November 15th, 2004 at 6:20 PM EST <#comment-298> Well, another day another version :D . This time I've added support for keeping track of the number of times a post is viewed, sorting by that column (for "Most Popular Posts" kind of lists), and displaying the count of pageviews. This one requires a modification of the WordPress posts table to add a field to keep track of the number of views. Details on installation can be found in this post . The current version of the code can be found here . 65. Oleg Tukh replied on December 6th, 2004 at 1:13 PM EST <#comment-315> Thank you Scott!! This is an excellent plugin. I used it to show the most recent posts on my website, which is in a different directory than my blog. Nicely done! 66. Aunty Spam replied on December 14th, 2004 at 2:55 AM EST <#comment-323> Dear Scott, Thi sis a *wonderful*, and wonderfully useful, plug-in. And no buts. Kissy kissy, Aunty 67. Ryan W. replied on December 20th, 2004 at 3:47 PM EST <#comment-330> I would like to use c2c_get_recent_posts on two different pages for two different sets of categories and two different offset values. It seems I'm not able to do this because the config is done in the plugin itself, rather than by passing arguments in the page. It looks like the only argument you allow for within the page itself is the number of entries. Would be great if things were handled in an array on the page itself like… |[?php c2c_get_recently_modified(num_posts=5& categories=21,23,34&offset=2); ?]| That way this could be used in a lot of different ways on different pages. Or maybe that's already possible and I'm missing something? Thank you… 68. Ryan W. replied on December 20th, 2004 at 3:55 PM EST <#comment-331> ps - looks like get_posts actually does what I asked for above, and is somewhat similar to coffee2code's plug on this page, though it's without some of this plugin's features. just fyi… http://wiki.wordpress.org/?pagename=get_posts 69. Scott replied on December 20th, 2004 at 4:28 PM EST <#comment-332> *ColdForged*: I /still/ haven't had the time to meaningfully look at your contributions, but will do so soon. Thanks again! *Ryan*: I think you are overlooking in the instructions the other arguments to the various Customizable Post Listings functions. What you ask for (listing only posts in certain categories and using an offset) are supported, among other things (i.e. only gettings posts posted by certain author(s), customizing the output string, etc). Note that I define the arguments one to a line in the instructions above, like so: |function c2c_get_recent_posts ($num_posts = 5, $format = "
    • %post_date%: %post_URL%
    • ", $categories = '', $orderby = 'date', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false)| 70. Ryan W. replied on December 20th, 2004 at 4:30 PM EST <#comment-333> pps - Actually, it looks like get_posts won't do what I want, because it doesn't provide a way to filter posts by category. I hope WP developers will come up with a solution for a future release that expands the functionality of get_posts by incorporating features of the customizable-post-listings & showcategories plugins. 71. Ryan W. replied on December 20th, 2004 at 4:31 PM EST <#comment-334> Scott… I think I get it now, re: your comment #69 above. Looks like this plugin already does what I want… thanks much!! 72. Scott replied on December 20th, 2004 at 4:39 PM EST <#comment-335> More specifically, here is the call you'd do based on your example: |%post_URL%
      Updated: %post_modified%", "21 23 34", "DESC", 2); ?>| Hope that helps! 73. snuf.dk » En uge+ med WordPress replied on December 21st, 2004 at 8:05 AM EST <#comment-338> […] ødvendigt. Pågældende plug-in m.fl. kan findes her. Jeg har været nødt til at fjerne et andet plug-in , nemlig det […] 74. Ryan W. replied on December 21st, 2004 at 4:05 PM EST <#comment-340> Is this plugin compatible with the use of [!–more–] to divide teaser text, as discussed at http://wordpress.org/docs/reference/post/ 75. Ryan W. replied on December 21st, 2004 at 5:15 PM EST <#comment-341> ps - Upon further review I don't think I like the whole idea behind [!–more–] because it's too jarring to the user to land on another page halfway down the page. So I don't think I'll use [!–more–] What I really want to do is display %post_content% if no excerpt is present in the db. But if an excerpt is present in the db — because an author filled out that part of the post form — then I want to display %post_excerpt% and %post_url% That's asking a lot. I'm guessing I won't be able to run PHP within $format to check if a db field is empty. Actually, though, [!–more–] would be a good solution if it just landed the user on the permalink, at the top of the page, and I'm guessing that's something I could do with a hack… or maybe within the parameters for the_content() Hmm… I guess my question about compatiblity with [!–more–] remains an issue… I can't get [!–more–] to work with this plugin. 76. Ryan W. replied on December 21st, 2004 at 5:44 PM EST <#comment-342> pps - Now I see how I can run some PHP to display excerpt or content based on conditions… I just have to do something like: $string = [ ...sundry formatting and code... ]; c2c_get_recent_posts (9999, "$string", '10', 'date', 'DESC', 2, 'F Y', '', false); ?> all is well! 77. Ryan W. replied on December 21st, 2004 at 7:37 PM EST <#comment-343> Here's the code I omitted from the comment above: [?php if [ some conditional thingy here ] { $formatting = [ sundry code and formatting right here ]; } else { $formatting = [ sundry code and formatting right here ]; } c2c_get_recent_posts (9999, "$formatting", '10′, 'date', 'DESC', 2, 'F Y', '', false); ?] So you can see there's an effort there to perform some tests and provide something different for the second parameter in c2c_get_recent_posts depending on conditions. But I'm not having success because the code above is executed outside the context of c2c_get_recent_posts(), so if I want to test whether there's an excerpt for a particular post, that doesn't really work. So I'm kind of back to square one, wondering if [!–more–] is the answer, and, if so, whether there's any way to use it with this plugin. Another possible solution would be if customizable-post-listings performed a test for the excerpt and then passed some value to my PHP page that I can use to toggle things in the format parameter. Or, if there was an additional percent tag like %post_excerpt_or_content% that would display excerpt if one is present in the db or content if no excerpt is present. Even if that kind of percent tag were available there 's still a need for other contingencies such as: What if I want to do [a href="%post_url"]%post_excerpt_or_content%[/a] if there's an excerpt but omit the link anchor if there's no excerpt (because then I wouldn't be linking to another page for the rest of the post.) My problem, just to clarify, is that I want to display excerpt + permalink for longer posts, and the entire content (and no permalink) for shorter posts. In other words, if my post is three sentences long, it doesn't make sense to provide a one sentence excerpt and a link to my three-sentence post. But for longer posts, I want to use the excerpt/link approach. From the content-author perspective, it would be nice to leave the excerpt field blank as my way of indicating that the entire post body should be displayed on the index — hence my desire to test for the presence of an excerpt in the db. But the next best thing would be to use something like [!–more–] when I want excerpt + link… if no [!–more–] is found in the post, then full content should be displayed and no link or link text. 78. Ryan W. replied on December 25th, 2004 at 4:38 PM EST <#comment-347> OK, I don't mean to turn this page into my personal journal, but here's how to test for an excerpt, for what it's worth… put this function in template-functions-post.php: function get_excerpt_status() { // don't forget to mark your hack global $id, $post; global $test_for_excerpt; $output = ''; $output = trim(stripslashes($post->post_excerpt)); if ($output != '') { $test_for_excerpt = 'pos'; // no excerpt } else { $test_for_excerpt = 'neg'; // there's an excerpt } } …then on your web page you can do something like this… [?php get_excerpt_status(); if ($test_for_excerpt == 'pos') { $formatting = blahblahblah; } else { $formatting = blahblahblah; } c2c_get_recent_posts (9999, "$formatting", '10′, 'date', 'DESC', 2, 'F Y', '', false); ?] 79. Ryan W. replied on December 25th, 2004 at 6:51 PM EST <#comment-348> ugghh. nevermind the above post!! that code doesn't work because get_excerpt_status() doesn't work outside the loop. 80. dozer replied on December 26th, 2004 at 8:34 AM EST <#comment-350> This is a great plug in which I've been using for a while for my 'most recent comments' sidebar section. Everything works as advertised, but I'm having a problem which by reading comments of others I think may not have come up yet, but I can't image why — or maybe I just missed it. On my site I restrict comments to registered users and have a few regular readers give me insightful comments once in a while. Every time I post however I normally will link back to previous articles — creating a pickback comment. eg. […] re going for the sealed temperature controlled house you might opt for something like this energy efficient sealed house The basement with glass to th […] What I want to do is to omit these pingbacks from the most recently commented list — since now someone who really wanted to see what is drawing comments will pull up a lot of posts which just have my own ping backs. Can you advise the best way to accomplish this (eliminate the pingbacks from the most recent comments)? Thanks for a great job and great hack! 81. Alan Farahani replied on December 29th, 2004 at 1:29 PM EST <#comment-353> Hello Scott, I want to thank you for an incredible plugin that makes so many things so much simpler! I actually have a question (to actually anyone who knows), is there a way that I can display all the posts only within one given month? It doesn't matter whether or not it outputs code with a sequential ordering of months rather than just outputting one month per "get_recent_post". IE March 2001 date/post date/post vs April 2001 date/post date/post |
      | March 2001 date/post date/post and so on and so forth Also, has anyone attempted the "%comment_excerpt_short%" tag yet? I would be very interested to hear of any developments! Sorry for the inane questions, php is most definately not a strong point! Thanks. 82. Scott replied on December 29th, 2004 at 7:32 PM EST <#comment-354> *Ryan*: I'll add a tag to the next version that indicates the excerpt, if present, should be shown, otherwise the post content will be shown. No worries about posting ideas/suggestions/solutions here, I appreciate the input. Hope you can hold out to the next release. *dozer*: Nice suggestion. I'll include more pingback and trackback stuff in the next release. In the meantime, if you wanted to try a hack to keep pingbacks from being seen as comments by this plugin, do the following in the plugin file: In the function c2c_get_recent_posts, at line 65 you should see this: |if ($add_recent_comment_to_sql) $sql .= "AND $tableposts.ID = $tablecomments.comment_post_ID AND $tablecomments.comment_approved = '1' ";| Change it to this: |if ($add_recent_comment_to_sql) $sql .= "AND $tableposts.ID = $tablecomments.comment_post_ID AND $tablecomments.comment_approved = '1' AND $tablecomments.comment_content NOT LIKE '%<&;pingback />%'";| Line 139 was this: |return $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = '$post_id'");| Change it to this: |return $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = '$post_id' AND comment_content NOT LIKE '%<&;pingback />%'");| Line 171 was this: |$comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date DESC LIMIT 1");| Change it to this: |$comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' AND comment_content NOT LIKE '%<&;pingback />%' ORDER BY comment_date DESC LIMIT 1");| So 3 lines that need changing. If that looks daunting, you can wait until the next release, but it really isn't that much for you to change if you were so inclined. The official version will have easy options to control whether pingbacks and trackbacks should be considered or not. *Alan*: For listing the posts by month, what you probably want is the Sortable Nicer Archives plugin . As for the %comment_excerpt_short% tag, in the next release of the plugin I'll include a tag that does just that (though likely named different). 83. Ryan W. replied on December 30th, 2004 at 9:44 AM EST <#comment-356> Scott, I went ahead and took a stab at writing a plugin that conditions formatting based on whether an excerpt is present in the database. It also does enough of what your plugin does to solve my current problem, though overall it's a more limited plugin and lacks a system of percent tags for now, so formatting must be done in the plugin itself. If interested see here . Gracias, Ryan 84. Standing Tall » WordPress プラグイン一覧追加情報(7) replied on January 6th, 2005 at 3:19 PM EST <#comment-367> […] ��各投稿記事を読むのにかかる時間を推定し表示するプラグイン。 CustomizablePostListings - カスタマイズ可能な投稿リス� […] 85. dozer replied on January 10th, 2005 at 6:10 AM EST <#comment-379> Scott, thanks for the hack. I had already done something similar, but didn't catch all the changes, so the comment counter wasn't consistant. Anyway, reistalled it per your instructions and it works great. Now pingbacks are excluded…… 86. Jascha replied on January 12th, 2005 at 4:33 AM EST <#comment-381> I was using this plugin withd 1.5 and nightly from 2005-01-12 and it works great! I had used it wih 1.2 and wanted to make sure it worked with 1.5 before I switched. Two quick questions: Is there a way to have most recent static pages (as there are in 1.5)? I was playing with the Way Too Clean template which has the 'Featured Story' block. Is there a way to have 'Recent Posts' exclude the last post from the list? Thanks! 87. Scott replied on January 12th, 2005 at 12:41 PM EST <#comment-388> *Jascha*: I'll include the ability to include static pages in the plugin's various functions in the next release. If you want to be able to do this in the meantime, you'll have to change a few lines in the plugin file. To minimize the number of code changes I tell you (if you want to pursue it), what exactly did you want to be able to do (just a "most recent static pages" listing)? As for excluding the most recent post from the list, that is achieved by setting the |$offset| argument to any of the plugin's functions. The value for offset indicates how many posts to skip. Set it to 1 and it'll skip the most recent post. 88. Jascha replied on January 12th, 2005 at 2:47 PM EST <#comment-390> Yes, I was wanting to have a listing of the most recent static sub-pages. So for example if you had a main page called 'Editorials' with all the actual editorials as sub-pages you could list them. Or just list the main pages. It was more a feature enhancement idea. I can wait for the next release to try it out. ;) I will give the |$offset| a try. Thanks for the help and plugin. 89. Thomas replied on January 13th, 2005 at 2:19 PM EST <#comment-393> I'm having issues using the $categories tag with the $offset tag. Code looks a-like this: $format = "%post_excerpt%", $offset = 1, $categories = 2); ?> Error is: Database error: [Unknown column 'wp_testposts.post_2′ in 'order clause'] SELECT DISTINCT * FROM wp_testposts LEFT JOIN wp_testpost2cat ON (wp_testposts.ID = wp_testpost2cat.post_id) WHERE wp_testposts.post_date <= '2005-01-13 12:59:35′ AND ( wp_testposts.post_status = 'publish' OR wp_testposts.post_status = 'sticky' ) AND wp_testposts.post_password = '' AND ( wp_testpost2cat.category_id = '1′ ) GROUP BY wp_testposts.ID ORDER BY wp_testposts.post_2 DESC LIMIT 0, 1 My intention is to use your plugin function in a loop, so I can do some more specific formatting (within table cells, etc.). To do this, I intend on setting $num_posts to one, $categories to whichever category the "index" is for, and $offset to an incremented variable within the loop. Of course, I can't get this to work from the singular instance I have at the top. 90. Thomas replied on January 13th, 2005 at 2:22 PM EST <#comment-394> Huh. My first post got cut off. I'm having issues using the $categories tag with the $offset tag. Code looks a-like this:| | Error is: | Database error: [Unknown column 'wp_testposts.post_2' in 'order clause'] SELECT DISTINCT * FROM wp_testposts LEFT JOIN wp_testpost2cat ON (wp_testposts.ID = wp_testpost2cat.post_id) WHERE wp_testposts.post_date <= '2005-01-13 12:59:35' AND ( wp_testposts.post_status = 'publish' OR wp_testposts.post_status = 'sticky' ) AND wp_testposts.post_password = '' AND ( wp_testpost2cat.category_id = '1' ) GROUP BY wp_testposts.ID ORDER BY wp_testposts.post_2 DESC LIMIT 0, 1 | My intention is to use your plugin function in a loop, so I can do some more specific formatting (within table cells, etc.). To do this, I intend on setting $num_posts to one, $categories to whichever category the "index" is for, and $offset to an incremented variable within the loop. Of course, I can't get this to work from the singular instance I have at the top. 91. Scott replied on January 13th, 2005 at 2:39 PM EST <#comment-395> *Thomas*: In order to specify the value for a function's argument, you must also specify the values for arguments that appear before that argument. You must also specify the arguments in the order they were defined by function. Here is probably what you wanted to use: || 92. Thomas replied on January 13th, 2005 at 2:52 PM EST <#comment-396> That did the trick. I'm gonna be whipping this internet in no time at all, thanks to you. 93. Ryan W. replied on January 14th, 2005 at 3:01 PM EST <#comment-402> I'm getting an error when I save posts: Warning: Cannot modify header information - headers already sent by (output started at /usr/home/spitf10/www/htdocs/wp-content/plugins/customizable-post-listings.php:306) in /usr/home/spitf10/www/htdocs/wp-admin/post.php on line 340 I checked to make sure there's no leading or trailing white space in the plugin file. I also re-copied your source from this page (v 1.1) into the file and uploaded. When I deactive the plugin, problem disappears. Reactivate, it's back. 94. Scott replied on January 15th, 2005 at 7:11 PM EST <#comment-408> *Ryan*: Try downloading the zip for the plugin, unzipping that, and uploading the file you extracted. As far as I know, 99.9% of the "Cannot modify header information…" errors are a result of leading and/or trailing white space (or other characters). 95. GRABBINGSAND - You got me writing lyrics on postcards. » Blog Archive » Adding Recently replied on January 16th, 2005 at 11:58 PM EST <#comment-412> […] Sound Unheard Adding Recently Minor addition. Using the Customizable Post Listing Plug-In from coffee2code, I've […] 96. Anton replied on January 19th, 2005 at 12:33 PM EST <#comment-422> Scott, I'm using your plugin to pull up dinamic content for my site, but its not a blog, so I had no need for "the loop" showing the rest of the posts. But by removing "the loop" from index.php and using your functions exclusively, disables alot of functions such as search, post popups, and coments. Any sugestions on how to retain all the functionality of "the loop" without showing all the posts? 97. Pierre Igot replied on January 21st, 2005 at 3:38 PM EST <#comment-425> Great plug-in. One question, though: Is there an easy way to request recent posts that are in BOTH category A and category B? Right now, if I put two category IDs separated by a space, your recent_posts function returns posts that are in EITHER category A OR category B. I'd like to return only posts that are in both. Is this possible? 98. Nathan replied on January 24th, 2005 at 11:37 PM EST <#comment-432> Just another request for a %comment_excerpt_short% function. This would be particularly useful for the author and I think enticing to those reading and already aware of recent post titles which often are present already on the page. Great plug in thank you! 99. Mark replied on January 25th, 2005 at 8:09 PM EST <#comment-433> I successfully installed your cool spellchecker program, and it kicks in, but then I get this crazy error: "/usr/local/share/aspell/en_US.dat can not be opened to read" My webhost is Pair.com, and they suggested to try 'en_US.multi' which I did, and got the same error. Any suggestions? Thank you very much. Mark Bishop 100. Scott replied on January 26th, 2005 at 7:47 PM EST <#comment-436> *Anton*: Your question is probably a multi-part question, with different answers for different parts. So it really depends on what exactly you are asking for. The "loop" does set global variables that other functions rely upon for typical "in the loop" sorts of activities, in which case many of those functions wouldn't work properly. I'm sure there are certain sorts of things that could be added to this plugin, or could be hacked in some way. Point out specific things you are looking to do and I can tell you how necessary the loop is for them. *Pierre*: I anticipate improved category support, including the case which you brought up, in a future version. Complex category handling can be tricky, so how much I implement and when is still up in the air. *Nathan*: Rest assured a comment_excerpt substitution tag will be included in the next release. *Mark*: You have the wrong plugin developer. You probably want ColdForged . 101. Blog de Mauricio Romero @ Guatemala » Tips Wordpress I Parte replied on January 28th, 2005 at 1:21 AM EST <#comment-437> […] mbién he encontrado maravillas de plugins que he utilizado para combatir el spam, agregar lista de pos […] 102. JB's Blog » 워드프레스 플러그인 - 최근 글 목록 등 나타내기 replied on January 29th, 2005 at 9:44 PM EST <#comment-446> […] 면 최근 작성한 글 리스트를 보여줄 수 있다. 플러그인 설명 원문 http://www.coffee2code.com/archives/2004/08/27/plug […] 103. ColdForged replied on January 31st, 2005 at 10:50 AM EST <#comment-459> / / /Mark: You have the wrong plugin developer. You probably want ColdForged./ Scott, you sure you don't want to provide support for my plugins as well? :D 104. Heather replied on January 31st, 2005 at 6:49 PM EST <#comment-462> Thank you so much! This is just what I wanted for my small piece of the Internet. Works like a charm. 105. Valerie replied on February 1st, 2005 at 6:48 PM EST <#comment-464> I just downloaded this plugin yesterday. I was trying to get recently_commented to output the date of the last comment, the name of the commenter link to the actual comment, and the title of post comment is in which is permalinked. I don't know much php, I can kinda read it, but not enough to code myself. Anyway, I played and played with the configurations to get it to do what I wanted, but it just wouldn't do it. You have |%last_comment_url%| defined in your code, so I had tried using that, but it just spit out |%last_comment_url%| on the page. It turns out that in the array at the bottom of your code, you have |%last_comment_URL%|, instead of |%last_comment_url%|. I made the slight adjustment in the array list and then wrapped |%last_comment_url%| in link html, and put that around |%last_commenter%| and now it does what I want. :) Yeah. Oh, I also thought I'd mention that for |%last_commenter_URL%|, if a URL is not provided for the comment author, the author's name is still clickable, but is directed to the current page. Thanks for another awesome plugin! :) 106. my weblog » Plugin�¸���ʥ����ȥ����ѹ��� replied on February 9th, 2005 at 4:33 AM EST <#comment-561> […] �顢Plugin�⤢�뤫�ʡ��Ȥ��פ��Ĥġ� ������õ���Ƥơ����������ʤΤ����ä�����ʤˤ��ˡ� Customizable Post Listings Display Recent Posts, […] 107. Dan replied on February 10th, 2005 at 8:20 AM EST <#comment-598> I'm very new to this system, and this is the first plugin im attempting to use. I have problems installing it though: I followed the installation instructions but it does not work. I simply placed the function: |function c2c_get_recent_posts ($num_posts = 5, $format = "
    • %post_date%: %post_URL%
    • ", $categories = '', $orderby = 'date', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false) | in the index.php as it said, between Parse error: parse error, unexpected ';', expecting '{' in /home/fhlinux198/i/ifmicecouldmovemountains.com/user/htdocs/news/index.php on line 64. Line 64 is the: | line. If I add a '{' it bring up yet another error.| Can anyone explain what I am doing wrong? 108. Dan replied on February 10th, 2005 at 8:21 AM EST <#comment-599> oops sorry. For some reason it didn't post this part of the message: Parse error: parse error, unexpected ';', expecting '{' in /home/fhlinux198/i/ifmicecouldmovemountains.com/user/htdocs/news/index.php on line 64 That is the error i get in my index.php 109. Scott replied on February 10th, 2005 at 10:33 AM EST <#comment-600> *ColdForged*: Heh; I've got my holds full with what I've got going here :) Incidentally, I've finally begun updating the plugin. I'm doing it in various stages; the interim steps are visible at dev.wp-plugins.org. I'll probably be able to roll in most of your customizations, except for the post_view_count stuff, which probably goes beyond the scope of this plugin. Thanks for contributing! *Valerie*: Thanks for pointing out those bugs. Their fixes will be in the next release. *Dan*: What you pasted into index.php was the code defining the function and not the code that calls the function. Look under the Tips & Examples <#examples> section for what you want to put into index.php. Namely, you'd want something like: || 110. Dan replied on February 10th, 2005 at 2:52 PM EST <#comment-601> I tried that, but then it says "atal error: Call to undefined function: c2c_get_recent_posts()" 111. Scott replied on February 10th, 2005 at 4:14 PM EST <#comment-602> *Dan*: Did you activate the plugin via the Admin's Plugins page? If so, where in index.php did you put this function? For that matter, are you using WordPress 1.2+ or 1.5? 112. Dan replied on February 10th, 2005 at 4:21 PM EST <#comment-603> Yeah I did activate it. I am using 1.2.1… Should I change the version I am using? 113. Dan replied on February 11th, 2005 at 8:59 AM EST <#comment-605> I got it working, it was my stupidity. One more question: is it possible to have more than one class streamreader in a page? I wanted to draw the "get recent posts" from a different database to that of another on the page. Instead an error of: Fatal error: Cannot redeclare class streamreader in /home/fhlinux198/i/ifmicecouldmovemountains.com/user/htdocs/live/wp-includes/streams.php on line 26 114. Streak Running Weblog » Blog Übersicht replied on February 17th, 2005 at 9:03 AM EST <#comment-698> […] n 4: SpamWordBlock v1.2 Plugin 5: Who Is Online? v1.1 Plugin 6: jVisitors v1.5.1 Plugin 7: Customizable Post Listings v1.1 Plugin 8: Theme Switcher v0.1 Pl […] 115. coldforged.org » Blog Archive » WordPress Asides, ColdForged-style replied on February 18th, 2005 at 10:07 AM EST <#comment-700> […] ghtforward but with some customization of plugins. I started off with Scott Reilly's Customizable Post Listings plugin. This is a plugin that makes […] 116. Ruby replied on February 21st, 2005 at 9:53 AM EST <#comment-778> Thanks for another great plug-in, Scott! I've got this up and running at http://lotusmedia.org/ om WP 1.5 but there's one problem. Where I'm using %last_comment_URL% it's displaying |http://lotusmedia.org/1053/02/20/2005%2008:05%20pm| but the permalink to the comment is actually |http://lotusmedia.org/1053/#comment-227|. Should I just manually make the link like: |%post_url%/#comment-%last_comment_id%| ? 117. Scott replied on February 21st, 2005 at 7:31 PM EST <#comment-780> *Ruby*: a couple questions — there is a typo in the code… search for "%last_comment_URL%" (with the quotes) and replace it with "%last_comment_url%" (again, with the quotes). Then use the all lowercase version when you define your format string. Does that fix your problem? If not, did the scenario you mentioned work in 1.2 but not in 1.5? Depending on what you're looking to do, it may already be done in the latest version of the plugin, which I'm hoping to finish up and release within the next week. 118. Ian replied on February 22nd, 2005 at 8:34 AM EST <#comment-783> I'm trying the same thing as Nikki [comment 39]. When it is taking the post-excerpt, it is taking/adding paragraph tags so that they end up in within the link and break my vailidation. Is there something in WP (1.5) I can disable or maybe a workaround? I'm currently using |(1,'<a href="%post_url%" title="%post_title%">%post_excerpt%</a>','14','date','DESC','0','d F Y','');| 119. Space Ninja Blog » Blog Archive » One Down replied on February 24th, 2005 at 4:03 AM EST <#comment-790> […] e. But I did finally find a post to do what I wanted (as you can see in the sidebar), with Coffee2Code.com's Customizable Post Listings plugin. Nex […] 120. Beetle Blog » Reading List Implementation replied on February 25th, 2005 at 1:15 AM EST <#comment-891> […] ingBrentlate evening ColdForged details how to use his version of Scott Reilly's Customizable Post Listings to generate asides and other cool th […] 121. John W replied on March 1st, 2005 at 11:17 AM EST <#comment-924> The docs state for $format : /"A string that uses percent substitution tags to define the data you want displayed for each listing and how you want it displayed;set it to '' (two single-quotes) to return an array of the requested post objects without outputting anything./" I'm using: $foo=c2c_get_recent_posts(1, $format='%post_content%'); but the post_content is still being displayed. I just want it stored in $foo for manipulation. How can I do this? 122. ColdForged replied on March 1st, 2005 at 2:29 PM EST <#comment-925> John, you'd have to modify the plugin to return the text instead of echo it. 123. matopc replied on March 1st, 2005 at 5:06 PM EST <#comment-926> Thanks for this great plugin, Scott. I've installed this plugin recently and noticed that |%comments_count%| actually counts all comments including ones marked as 'spam' and stored in the database. So the function |c2c_comment_count| may be better if reads: |function c2c_comment_count ($post_id) { global $wpdb, $tablecomments; if (!isset($tablecomments)) $tablecomments = $wpdb->comments; return $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'"); } //end function c2c_comment_count()| Thanks. 124. __Sakurazuka No Maboroshi__ replied on March 3rd, 2005 at 6:49 PM EST <#comment-1038> […] ", encore et toujours avec la customisation de la sidebar (le truc l�, � droite) via ce plugin. Au lieu donc d'afficher les derniers posts com […] 125. Sean Langlands replied on March 7th, 2005 at 12:55 AM EST <#comment-1082> Great Plugin. Will be using this for my Sites new version. :) 126. Timo replied on March 7th, 2005 at 9:48 AM EST <#comment-1138> Any news of the updated version Scott? I'm waiting to install it on my site, but wondering if a new version would solve some of these queries… 127. gleem replied on March 9th, 2005 at 8:29 PM EST <#comment-1151> hey, I tried installing this and I get: "Parse error: parse error, unexpected T_STRING, expecting '&' or T_VARIABLE or T_CONST in line 33″ which is: $format = "%post_date%: %post_URL%", no matter what type of plugin I try to get a "recent post" list going in my side bar, I get parse errors, was hoping you can help! 128. Standing Tall » Blog Archive » WordPress プラグイン一覧追加情報 (7) replied on March 10th, 2005 at 2:58 AM EST <#comment-1152> […] ��各投稿記事を読むのにかかる時間を推定し表示するプラグイン。 CustomizablePostListings - カスタマイズ可能な投稿リス� […] 129. Beetle Blog » Reading List Implementation replied on March 15th, 2005 at 3:18 PM EST <#comment-1298> […] evening ColdForged details how to use his version of Scott Reilly's Customizable Post Listings to generate asides and other cool th […] 130. Liz replied on March 16th, 2005 at 5:56 PM EST <#comment-1351> Hey, you make amazing plugins! I was just wondering, is it possible to combine this plugin and the custom field plugin? As in, in the format variable of the recent posts function, can I put the to get the input for that recent entry's custom field into the recent post listing? I figure this is too good to be true and impossible, but I figured I'd check! If not, is there anyway to include an entry's custom field into the recent listing? Thanks :) 131. Ash Haque replied on March 17th, 2005 at 4:03 AM EST <#comment-1365> Amazing job with this plugin, using it on my site right now! 132.