Plugin: Customizable Post Listings
coffee2code.com/wp-plugins/customizable-post-listings
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.
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
- 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 <?php or after the ?> - Optional: Change configuration options in the file to your liking. In-code comments should help you there.
- Activate the plugin from your WordPress admin ‘Plugins’ page.
- Include one or more of the templates defined below into a template file (most likely sidebar.php)
function c2c_get_recent_posts ($num_posts = 5, $format = "<li>%post_date%: %post_URL%</li>", $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 = "<li>%post_date%: %post_URL%</li>", $categories = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $authors = '', $include_passworded_posts = false)
function c2c_get_recently_commented ($num_posts = 5, $format = "<li>%comments_URL%<br />%last_comment_date%<br />%comments_fancy%</li>", $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 = "<li>%post_URL%<br />Updated: %post_modified%</li>", $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
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):
<ul> Recent Posts <?php c2c_get_recent_posts(3); ?> </ul>
Would output something like:
- Recent Posts
- 08/03/2004: Patch: Dealing with multiple <!–more–>
- 08/03/2004: Patch: Balancing pre-’more’ tags
- 08/03/2004: Patch: Fixing balanceTags()
<ul>Recently Commented <?php c2c_get_recently_commented(3); ?> </ul>
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
<ul>Recently Updated <?php c2c_get_recently_modified(3); ?> </ul>
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:
<ul> <?php c2c_get_recent_posts(3, "<li>%post_date%: %post_URL%<br />by: %post_author_posts%<br />%post_excerpt_short%</li>", "34"); ?> </ul>
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…
- 27 Sep 2004 : v1.2 –
- 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
- Added the ability to get random posts, and added the convenience function
- 05 Sep 2004 : v1.02 — Bugfix to immediately return if no posts match criteria
- 03 Sep 2004 : v1.01 — Bugfix for when
$authorshas more than one author - 27 Aug 2004 : v1.0 — Released to the public
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.

[...] ? ?? ??? ? ???? ??? ? ??. ???? ?? ?? www.coffee2code.com/archives/2004/08/27/plug [...]
[...] info, craft.idahocline.info, gallery.idahocline.info Some new internal stuffs (plugins as Customizable post listing, Category images and … e you so [...]
[...] 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 [...]
[...] ø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 [...]
[...] ??????????????????????????????? CustomizablePostListings – ?????????????? [...]
[...] Sound Unheard
Adding Recently
Minor addition. Using the Customizable Post Listing Plug-In from coffee2code, I’ve [...]
[...] mbién he encontrado maravillas de plugins que he utilizado para combatir el spam, agregar lista de pos [...]
[...] ??Plugin????????????????? ??????õ?????????????????????ä???????????? Customizable Post Listings Display Recent Posts, [...]
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
customizable post listings plugin
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.
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.
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.
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
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!
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
Sorry, gives foreach() error on line 140 as well as 76
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?Yep, using c2c_get_recent_posts(). Re debugging: glad to do whatever you think might help
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.
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.
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:
Let me know what it says for your site.
mikey: What you tried initially would probably have worked if you added parentheses like so:
I am considering the addition of this change to the plugin. Thanks for reporting the issue and finding the fix!
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)
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
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:
<?php c2c_get_recent_posts (5, "<li>%post_date%: %post_URL%</li>", '', 'date', 'DESC', 0, 'd/m/Y'); ?>
(you have to explicitly define all the arguments before the
$date_formatargument)Or, alternatively, you could change the default value for the
$date_formatargument 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).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!
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():
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_wordsto 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_wordsto 0 and change the value of$excerpt_length.Does that accomplish what you need?
Scott, any further suggestions re the feedback I gave on Monday?
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
OK, the author selector seems to work as long as ID doesn’t equal 1. Wonder why that is…
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.
is there anyway I could get this to grab a random post from a category instead of the latest post?
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
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.
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. ?
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
as a variable…and i saw one that said modified instead of updated so i changed updated to modifiend so it looked like
instead and it worked fine!
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
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) wasc2c_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:
<?php c2c_get_recently_modified(5,'<li>%post_URL% (%comments_count%)<br />Last comment: %last_commenter% at <a href="%last_comment_url%" title="Read the comment">%last_comment_date%</a></li>'); ?>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).
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.
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! =)
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
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.
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.
Hi, how can I edit this plugin to get a list of most read posts (popular posts).
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.
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:
<?php c2c_get_recent_posts(4,'<a href="%post_url%" title="%post_title%">%post_excerpt%</a>'); ?>Thank you an incredible amount. This SO rocks.
Why didn’t I find it sooner?!
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.
Thanks for the great work… it’s a rock’n plugin.
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…
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.
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!
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.
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
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.
Great plugin. Thank you very much!
But I have some problem. With function:
<?php c2c_get_recent_posts(10,"<li><span class="recent-post-date">%post_date%</span>: %post_URL%<br />by: %post_author_posts%</li>",'','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:
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?
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?
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.
Of course, error in original code in the titles of the comment links. Here’s the updated code.
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:
<ul><?php c2c_get_recent_posts(5, "<li>%post_URL%</li>", '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
<?phpat the start of the file or after the?>at the end of the file.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.
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!
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.
Latest additions available here.
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???
Thanks, Scott! I didn’t realize I had whitespace. It’s working like a charm now~
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.
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.
Well, another day another version
. 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.
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!
Dear Scott,
Thi sis a *wonderful*, and wonderfully useful, plug-in. And no buts.
Kissy kissy,
Aunty
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…
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…
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… wiki.wordpress.org/?pagename=get_posts
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:
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.
Scott… I think I get it now, re: your comment #69 above. Looks like this plugin already does what I want… thanks much!!
More specifically, here is the call you’d do based on your example:
<?php c2c_get_recently_modified(5, "<li>%post_URL%<br />Updated: %post_modified%</li>", "21 23 34", "DESC", 2); ?>Hope that helps!
Is this plugin compatible with the use of [!--more--] to divide teaser text, as discussed at wordpress.org/docs/reference/post/
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.
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:
< ?php
$string = [ ...sundry formatting and code... ];
c2c_get_recent_posts (9999, "$string", '10', 'date', 'DESC', 2, 'F Y', '', false); ?>
all is well!
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.
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);
?]
ugghh. nevermind the above post!! that code doesn’t work because get_excerpt_status() doesn’t work outside the loop.
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!
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
<br/>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.
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).
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
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……
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!
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
$offsetargument 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.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
$offseta try. Thanks for the help and plugin.I’m having issues using the $categories tag with the $offset tag.
Code looks a-like this:
< ?php c2c_get_recent_posts($num_posts=1,
$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.
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:
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.
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:
<?php c2c_get_recent_posts(1, "%post_excerpt%", "2", "date", "DESC", 1); ?>That did the trick. I’m gonna be whipping this internet in no time at all, thanks to you.
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.
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).
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?
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?
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!
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
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.
Scott, you sure you don’t want to provide support for my plugins as well?
Thank you so much! This is just what I wanted for my small piece of the Internet. Works like a charm.
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
Yeah.
%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.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!
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:
in the index.php as it said, between < ? php tags. However I then get this error:
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?
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
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 section for what you want to put into index.php. Namely, you’d want something like:
<?php c2c_get_recent_posts(); ?>I tried that, but then it says “atal error: Call to undefined function: c2c_get_recent_posts()”
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?
Yeah I did activate it. I am using 1.2.1…
Should I change the version I am using?
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
[...] 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 [...]
[...] ghtforward but with some customization of plugins. I started off with Scott Reilly’s Customizable Post Listings plugin. This is a plugin that makes [...]
Thanks for another great plug-in, Scott!
I’ve got this up and running at 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%20pmbut the permalink to the comment is actuallyhttp://lotusmedia.org/1053/#comment-227.Should I just manually make the link like:
%post_url%/#comment-%last_comment_id%?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.
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','');[...] 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 [...]
[...] ingBrentlate evening ColdForged details how to use his version of Scott Reilly’s Customizable Post Listings to generate asides and other cool th [...]
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?
John, you’d have to modify the plugin to return the text instead of echo it.
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_countmay be better if reads:Thanks.
[...] ”, 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 [...]
Great Plugin. Will be using this for my Sites new version.
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…
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!
[...] ??????????????????????????????? CustomizablePostListings – ?????????????? [...]
[...] evening
ColdForged details how to use his version of Scott Reilly’s Customizable Post Listings to generate asides and other cool th [...]
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
Amazing job with this plugin, using it on my site right now!
I’m liking this plugin but one problem I’m facing is that posts with long titles for recents posts in the side bar seemingly move over tot he content side and push the content down – is there a way to wrap the text so that if the title is long that it continues it on the next line? Or perhaps to create a shorter URI of the link.
SO for example instead of Ben goes shopping to the supermarket it becomes Ben goes….?
Please advise, and thanks in advance
Hi I discovered it was my own XHTML being invalid causing the problems. Works perfectly, my only problem is that the page now invalidates with the plugin – if that makes sense? Any tips one what I can do to get the page valid with the use of the plugin?
If you try to validate reviews.sekhu.net you’ll find many ul and li errors listed, this I assume is the output of the plugin in order to create the lists.
Hope you can help.
Is there a way to get the time as part of the post for “Recent Posts”. I know you can get it for comments. But I am very interested in the time for posts as well???
Thanks!
GREAT set of tools…. even works with the new 1.5 version…… just add a little CSS styling and it looks perfect….
Great job…..
Disregard the previous question. To do it I just editied the PHP to be’m/d/Y h:i a’ . . .if anyone else has this problem.
Is there a way to not include the posting date when using the recent posts function?
Scratch that, I already figured it out. Thanks by the way for an very userful plugin.
[...] Lesson
WordPress – theme »
WordPress – PlugIn(s)
coffee2code.com » Plugin: Customizable Post Listings theme:c [...]
[...] system that uses popups? Beginner-friendly means of outputting entry data. One example is Scott Reilly’s method of formatting entry data. This meth [...]
[...] ak this into pieces!) Ensure CSS renders properly P1 (should do) Generate views to see recently updated posts Setup statistics logging P2 (nice to d [...]
Is there a way that I can set up this plugin to output the 3-4 most recently update pages?
Ash: Not yet. But there will be within the next couple of days…
[...] ing recent comments, recent modified posts, random posts, and bla bla bla…visit this site for more details… [...]
[...] ?????????????????????????????? Customizable Post Listings ???????????Rec [...]
After enabling this plugin on my site, the site stopped redirecting when the actions (where actions mean: page redirect after post, edit, login, or logout) are taken and shows blank pages. I really need this plugin because this is the only one which enables what I want.
I would like to know, if someone has already faced this before and the solution hopefully. My version is 1.5 strayhorn.
Please help!!
[...] system that uses popups? Beginner-friendly means of outputting entry data. One example is Scott Reilly’s method of formatting entry data. This meth [...]
[...] modifications for tighter security, visit scriptygoddess via link above. 2. Scott Riley: Cutomizable Post Listings I got confused a little with Scott&# [...]
Found a compatibilty problem!
IF you have this and the comments plugin installed, and then try to have activate both you will cause a “duplicate function” error. c2c_comment_count() function is declared in both plugins. Simple, but dodgy fix is just to rename one of the functions
.. I guess there is a better way around this, however at least that way both plugins will still work independently …
Hi! Hate to be such a newbie, but I can’t help it! I am.
Where, oh, where do I put the function code in the index?
is it possible to modify the query to get all posts from a chosen category? I’m trying to set a category page.
garnet read the instructions at the top with regards to categories – I do this myself and it works great.
Does anyone know how to specify the number of words or characters for an excerpt. Any chance this level of flexability could be added? The excerpt_short_ is a single line, and exludes any formatting and images, whereas the Excerpt option offers the exclusions but is too big. The configuration of charactes and words would allow a middle ground I Think.
Would be great if it can be added.
Great plugin
Nice plugin. Is there any known hack for this plugin which would allow “recent posts” to show future posts? I’m setup with WP 1.5 (kubrick – allsidebar theme) using the eventcalendar2 plugin which has been hacked per suggestions from wordpress.org/support/topic.php?id=2518 .
Thanks in advance!
-SS
is it possible to exclude the first post? (and the second post?)
what code do I need….?
dear scott:
I had been blundering through wordpress trying to create a new website with feeds from our webblog all weekend. Then I found your pluggin and it saved me. Thank you, I will always remember.
Tom
@ dydrec use offset to exclude posts read the instructions at the top on how to do this.
scott: is there anyway to truncate the title of the URL? I;m using the recent excerpts, but I need to truncate the title to about 5 words or less.
Thanks
scott: thanx for your great plugin in! One quick question. I’like to list the last 5 post of the author of the current page. I’ve tried with:
%post_date% - %post_URL%", "", "date", "DESC","0", "d/m/Y", "'"); ?>, but it doesn’t work. Is it possible to do what i have in mind? Thank you![...] , for this other site I’ve been working on, I am making use of a handy plugin called Customizable Post Listings. This entr [...]
I use this plugin to show random posts but sometimes it diplays post titles longer than my sidebar. How can I get shorter titles?
I’d like to truncate the them. Please help.
example:
post title (before):
this is the title number 1
post title (after):
this is the title…
zonekiller I believe scott is working on an update, so just be patient for a while, he’s including truncation of titles, which is something I am very keen to see included as are a few others, so this will be quite an update. looking forward to it
[...] in to insert recent posts in the WordPress sidebar. It’s here if you are interested: Customizable Post Listings Plugin [...]
[...] er 2005 Take care Great Customizable Post Listings Plugin! Questo plugin di Scott Reilly e’ fenomenale, riuscirete con un p [...]
Very nice plugin! The Random Post feature will surely dredge up a lot of blasts from the past
Thank you sekhu!
excellent plugin!
as a feature request, would it be possible to add a variable for limiting the queries by date?
I’m trying to show a random post from a particular category, but only want it to pick from the last 30 days, rather than the entire category’s archive
Wonderful plugin!
great plugin-
question: i want to display in my sidebar 5 most recent posts plus short excerpt. but the way i have it set up, the excerpt from the first post repeats itself in the other 4.
here’s what i’m using
[code]%post_date%: %post_URL%-%post_excerpt_short%")?>[/code]
is this correct?
oops
bb tags!
i meant this
%post_date%: %post_URL%-%post_excerpt_short%")?>sorry :p
Using the c2c_get_recent_posts – and I would like omit the post title and have just the date itself be the link to the post. Is there an easy way to do this? So, instead of looking like this:
20050505: This is the title
I want, just the date and for the date to be the new permalink to the post.
Also, don’t know much about php – most everything I do is a painstaking bout of ‘let’s change that and see what happens’ sort of programming. How do I use both the c2c_get_recent_posts and the c2c_comment_count together, so that it prints the comment count after the post title.
Thanks in advance
[...] enti: una mancanza veramente seccante, come si intuisce. Una piccola ricerca, e ho scovato un plug-in chiamato ‘Customizable Post Listin [...]
[...] has gone haywire. Not really sure what’s happening. (T^T) Made some changes to the Customizable Posts Plugin for WP [...]
Scott,
Another vote for “recent static page” functionality. Essentially I’d like to be able to display the “x” (in my case, either 3 or 5) most recent static pages that are a child of a certain page in the hierarchy.
So, for example, in the context of my site, I’d like to be able to generate a list of the 5 most recent gear reviews (using the Page function, not Posts) which would be displayed in the sidebar template.
You had mentioned a few months ago (above in the comments) that someone could tweak the current release to achieve similar functionality. Is this still the case, or will a new release be available soon?
Your plugin has been very helpful for posts… if I can get it to work with pages, I’ll be very grateful.
uhmm… I hope you’ll release a new update soon.
hi scott, i’ve just come across a requirement for this for myself, and perhaps something you could add to an update?
I’ve been wanting to place the category for the recent list for an entry.
for example:
category name date of entry post title link excerpt
any chance this could be added to the next version?
[...] thinking about switching from using Coranto to something called WordPress. www.coffee2code.com/archives/2004/08/27/plugin-customizable- [...]
[...] ngs of posts and/or comments on your sidebar. I easily installed the plugin according to Scott Reilly’s instructions. Now I have “Recent Po [...]
[...]
coffee2code.com
coffee2code.com
[...]
[...] ?????, ?????????????BLOG?????. ?????: Customizable Post Listings. ???????????cu [...]
[...] ???????: Recent Post < ? php c2c_get_recent_posts(3); ? ????????.
Posted WordPress on Friday, J [...]
How about when you get header erros no matter what you do (that .1% you mentioned).
I’ll answer my own question – you look even closer, for that space.
I’m using this plugin with the wp-unformatted plugin, and getting random posts via Customizable Post Listings ignores the functionality of wp-unformatted. Any ideas?
Way cool! I think that this is just the thing I was looking for. The ability to define the excerpt is superb.
I am wondering – as a css noob – how do I go about applying css to the elements of this plugin? I have everything in a div which allows me some editing – p, a, etc… For instance, I want to specify how the date looks… I know there is an easy way to go about it.. just haven’t found it yet!
Thanks for a great tool!
tGriff
Hey, a great plug-in! This is exactly what I need for my website.
However, I’m having trouble showing posts by a single author. I’m adding the code to the author.php page, where I want it to be a profile/bio page + recent posts of that particular author.
I would really like to find a way to make the author id value into a variable, instead of a constant number.
I tried various things including:
[in the plug-in file]
$authors = '$author_id',[in author.php file]
Please let me know if it is even possible.
- Kevin
[...] juga para pembuat plugins tengkyu … Update 26/06/05 Pasang lagi plugins baru yaitu Customizable Post Listings dari Coffee2Code dan Recent Comments [...]
I was just wondering when the next release of this plugin is coming out.
I am using it right now to show the 5 most recent posts. I have many categories and it would be nice to be able to list what category the recent post is from.
Thanks
[...] nder WordPress 1.5, and all took just a simple upload and activating in the Plugins menu. Recently commented posts is actually much more than that. The o [...]
[...] yle??????????LuvRed2?????????????????Customizable Post Listings???exclude?? [...]
Greetings
I’m a rank beginner at WP and php. I’ve found your Customizable Post Listings plugin to be very valuable. First of all: thank you.
I’ve got not only to put a list of recent posts in the sidebar, but also to string a list of titles of the posts on the main page across the top of that page. I was hoping to be able to hotlink the titles in that list to the items themselves on the main page (as opposed to their permalink, single page appearances).
I’m half way there, because I’ve caused my index to create a name anchor using the “the_title” function for each item on the main page.
But when I try to force your
$format = "“%post_title%”, ",to create a link to the named anchor, I get errors no matter how I try. I’ve surrounded your%post_title%with the appropriate markup and have even tried to escape the number sign. No luck. I’ve also tried to substitute the php the_title function for your percent function in the href; again no luck.Rather than continuing to thrash ignorantly, I thought I’d ask you if you can see a way to accomplish what I want. To repeat: I’m after a list — a table of contents, if you will — for the main page, with each title in the list hotlinked to the item itself on the main page.
Any help would be very greatly appreciated.
Cheers,
Simon
[...] o; Änderungen vornehmen Aktivierung » Test Habe gerade die installiert…… Mein erster [...]
Does using this plugin eat into the # of posts set in WP Preference?
I am using it in my sidebar as a sort of “Asides”. In WP Preference, I set to display at least 7 posts. The plugin in my sidebar displays 4 posts from cat1 and the index page, excluding cat1, should at least display 7 posts, but instead only shows 3.
any advice? thanks.
[...] ? vai dar razão pra mim… Desativei o plugin agregador de feeds, e instalei o plugin Customizable Post Listings, que faz simplesment [...]
Hi there,
I’d like to display a list of all posts and pages recently updated or posted. With
“); ?>
I get the most recently modified blog posts, displayed in the way I want, but I don’t get pages which were recently modified or posted.
Any way to achieve that?
Thanks ahead for wrapping your brain around this
oops…
I replace braces to show the code – hopefully:
{?php c2c_get_recently_modified(15, “%post_date%: %post_URL%{br /}”); ?}
I’ve been working with MCincubus and mdawaffe to turn the category.php into a customizable category page without using the category-6.php and category-15.php customizable category template technique. We’ve managed to convert all kinds of things into conditional tags that generate content based upon the category and it’s parent, but we’re stuck with a problem with this tag.
query_vars['cat'], "%post_URL%", $cat); ?>I hope that goes in as code.
During the process, the $num_posts got left out. It was still generating the list, so we didn’t notice until after all the rest of the testing.
I’d like to add back in the number of posts (10), but I can’t get it to work with the query and $cat reference. Any ideas? I’ve tried:
query_vars['cat'], "%post_URL%", $cat); ?>And using single and double quotes around things, but it totally stops the list from generating. The first one works, it just generates 3 posts in one place, 5 in another, and 15 in another.
Any help would be appreciated. We’re writing this up for the Codex. Thanks!!
Thanks for you plugins it’s very good. I test the Comment post and when i active the plugin give me the follow error…
Fatal error: Cannot redeclare c2c_comment_count() (previously declared in C:\mi webs\wordpress\wp-content\plugins\customizable-comment-listings.php:197) in C:\mi webs\wordpress\wp-content\plugins\customizable-post-listings.php on line 140
help me…thanks.
Hi,
great plugin!
I just want to show the full name of the authors and not the nice-names (given by %post_author_url%).
How can I patch the plugin to show them?
S.
ups,
sorry. I meant “%post_author_posts%”
?? My first comment disappeared. OK, again:
I want to show the real author names instead of the nice names. I am using “%post_author_posts%”
How can I get the real names? Is there a patch already for this?
Stefan
Help me!!! When i try active the plugin provoque this error: Fatal error: Cannot redeclare c2c_comment_count() (previously declared in C:\mi webs\wordpress\wp-content\plugins\customizable-comment-listings.php:197) in C:\mi webs\wordpress\wp-content\plugins\customizable-post-listings.php on line 140
Help me!!!
Greetings !
In reference to commet:53 above, does anyone have the link to the modified code by ColdForged?? The link provided by coldforged doesnt seem to work. I need the modified code so that i could add links to the fancy comments.
cheers
My host, Dreamhost, has shut my website or my comments down twice because the query run by Customizable Post Listings was using too much server time. You can read about this in detail on my blog, if you want, but here’s a paragraph from a recent email they sent me:
Part of the problem is that my blog has an extremely active comments section, leading to a huge comments table.
Do you have any advice for me? I love the CPL plug-in, and would really like to continue using it – in fact, it’s essential for a blog like mine, in which conversations can continue for weeks on one blog comments thread. But, obviously, I can’t run it if it causes DreamHost to shut me down.
Thanks very much for your time, and for creating this plug in.
I need the same function as pierre as I wanted to use this to pull out featured posts from specific categories..
I was going to use a feature category and then pull out stories which were in both the featured category and the specific “sport” or “news” category.. to create the featured stories seciton..
If you want to use catg name like a tag you can do that:
find:
after add this:
find this:
"%post_title%", // Title for postafter add:
"%catg_title%", // Title for catgAfter this little tweak you can use %catg_title% to display category name
Ex.:
c2c_get_recent_posts('',"%post_URL%%catg_title%%post_excerpt%", '1', 'date', 'DESC','1','','','', false); ?>[...] Adding the Customizable Post Listings plugin. [...]
[...] www.coffee2code.com/archives/2004/08/27/plugin-customizable-post-listings/ [...]
very Good , thanks For Your Plugin
I include the below code into my sidebar.php:
Recent Articles”;
c2c_get_recent_posts (7,”%post_URL%”,’’,’date’,
‘DESC’,1,’m/d/Y’);
echo “”;
} ?>
all I got is this error although i have already activated the plugin.
Parse error: parse error, unexpected ‘>’
Please help, Thanks a million
[...] The theme currently utilizes the random posts functions from the wonderfull Customizable Post Listings plugin. If you don’t have that plugin installed, it will just use your blog’s description. [...]
[...] 80.1 è il primo tema rilasciato dall’ Action80 Web Studio. Si tratta di un classico a due colonne, con barra laterale sulla destra. Da notare che questo tema utilizza il plugin Customizable Post Listings per inserire nella parte alta della pagina un link ad un articolo in maniera casuale. Qualora non aveste installato questo plugin, verrà visualizzato la descrizione del vostro blog. [...]
[...] In alternativa, esiste un altro plugin che permette di ottenere una elenco di post recenti personalizzabile, su coffee2code. [...]
[...] Customizable Post Listings [...]
Is it possible to remove the bullet points on the side of each recent comment? (See site under comments header for example). I would like the comments to be flush to the left side. Any help would be greatly appreciated.
I’m having real trouble applying different styles to the date and post title. I want a list which shows date/post, date/post and have a template with a UL and a class to separate the styles. How can this be done?
Rhanks,
Sam.
I was looking for a plugin that lists all post headings on my home page and this plugin did the job for me. I just have a simple listing now, but would like to enhance it as below :
category1 :
post 1 heading by author
post 2 heading by author
…..
category 2:
….
Any help appreciated ..
WordPress plugins used on Aleeya dotNet
…
I’d like to use this plugin but i can’t get it to work.
On my mainpage i would like 5 posts (with read more) and below it the headlines off 25 other posts.
Iam using the Blix theme and wp1.5.2
What i did:
- Download & Upload the plugin
- Activate it
- Pasted one of the funtions above into the index.php in the exerp(not the regular index.php but the one into the provided by blix, in the same folder as the side bar).
When i reload the page i get an error.
Could you please help me out?
This is the part of code i tried to use it into. Replaced it with the function of this plugin or added it, none worked:
” title=”Permalink”>
.png” height=”105″ width=”104″ hspace=”1″ vspace=”1″ align=”left” />
post_excerpt != “”)? the_excerpt() : the_content(); ?>
post_excerpt != “”) { ?>” class=”more”>Lees verder
om
‘,”); ?>
Figured it out
Is it also possible to add the time in front of the date?
Figured that out as well
It’s finished
www.nieuwszicht.com/
If Scott Reilly has some time, please contact me, i have some questions about the plugin codes, but it’s to difficult to ask here (without seeing the whole code for you)
[...] www.coffee2code.com/archives/2004/08/27/plugin-customizable-post-listings/ [...]
I installed and activated the plugin. Nothing happens. The page looks the same as before. Any steps that I missed? I am familiar with php. Please help!
Oops! I meant ‘I am not familiar with php at all.’
great plugin
tnx
Hi Scott, hope you can help. I’m getting double spacing on this :
On my other theme it looked fine in single spacing, but now it doesnt look very good with my new theme, could you have a quick look at let me know what I might need to tweak?
Any tips would be greatly appreciated!!
thx!
[...] Customizable Post Listings plug in. Also known as the "Recent Posts" plugin. What this does is list your last 3 or 5 posts on your top right panel. Of course you can modify it to any number of posts to be listed, and place the list any where you want. This plugin helps us further optimize our pages for better keyword density and relevance! Which helps us in search engine results pages (serps), and ping services. All you do is upload one file [...]
[...] [...]
[...] Listado de posts personalizable [...]
[...] Customizable Post Listings: Cho phép hiển thị bà i viết mới nhất, comments mới nhất, bà i viết ngẫu nhiên. [...]
[...] – Not a personal development site, but if you use WordPress for your blog, make sure to grab the Customizable Post Listings plug-in. See that section down below that says "Random Great Posts from the Past"? That [...]
[...] display a bit of WordPress code from a WordPress Theme which initiates the Customizable Post Listings WordPress Plugin, if it exists, it would be written like [...]
[...] Customizable Post Listings WordPress Plugin [...]
[...] display a bit of WordPress code from a WordPress Theme which initiates the Customizable Post Listings WordPress Plugin, if it exists, it would be written like [...]
[...] require more customization, adding parameters to the Plugin to get the results you want. The Customizable Post Listings WordPress Plugin allows you to display the most recent 10 posts on your [...]