coffee2code.com/wp-plugins/customizable-comment-listings
Display Recent Comments, Pingbacks, and/or Trackbacks, as well as other comment listings using the comment and/or post information of your choosing in an easily customizable manner. You can narrow commentt searches by specifying post IDs, comment types, and/or comment status, among other things.
List of percent substitution tags supported:
"%comment_author%", // Name of commenter "%comment_author_email%", // E-mail of commenter "%comment_author_ip%", // IP of commenter "%comment_author_url%", // URL of commenter "%comment_author_URL%", // Linked (if URL provided) name of commenter "%comment_date%", // Date for comment "%comment_excerpt%", // Excerpt for comment "%comment_excerpt_URL%", // Excerpt for comment hyperlink to full comment "%comment_id%", // ID for content "%comment_link%", // URL to comment (same as %comment_url%) "%comment_text%", // Full content of the comment "%comment_time%", // Time for comment "%comment_type%", // Type of comment ('comment', 'pingback, or 'trackback') "%comment_url%", // URL to comment /* THESE PERTAIN TO commenters MODE (and only work in commenters mode) */ "%total_comments%", // Total number of comments for a commenter /* THESE ALL PERTAIN TO THE RESPECTIVE COMMENT'S POST */ "%allcomments_count%", // Number of comments + pingbacks + trackbacks for post "%allcomments_fancy%", // Fancy reporting of allcomments "%comments_count%", // Number of comments for post "%comments_count_URL%", // Count of number of comments linked to the top of the comments section "%comments_fancy%", // Fancy reporting of comments: (see get_recent_tagmap()) "%comments_fancy_URL%", // Fancy reporting of comments linked to comments section "%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 "%pingbacks_count%", // Number of pingbacks for post "%pingbacks_fancy%", // Fancy report of trackbacks "%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_status%", // Post status for post "%post_time%", // Time for post "%post_title%", // Title for post "%post_url%", // URL for post "%post_URL%", // Post title linked to post's permalink page "%trackbacks_count", // Number of trackbacks for post "%trackbacks_fancy", // Fancy reporting of trackbacks
- Download the file customizable-comment-listings.zip and unzip it into your /wp-content/plugins/ directory.
-OR-
Copy and paste the the code ( customizable-comment-listings.phps ) into a file called customizable-comment-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 your index.php
function c2c_get_comments ($limit = 5, $format = "", $mode = 'comments', $types = 'comment pingback trackback', $status = '1', $ids = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $include_passworded_posts = false )
function c2c_get_recent_comments( $limit = 5, $format = "<li>%comment_author%: %comment_excerpt_URL%</li>", $types = 'comment pingback trackback', $status = '1', $ids = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $include_passworded_posts = false )
function c2c_get_top_commenters( $limit = 5, $format = "<li>%comment_author_URL% (%total_comments%)</li>", $types = 'comment pingback trackback', $status = '1', $ids = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $include_passworded_posts = false )
function c2c_get_recent_commenters( $limit = 5, $format = "<li>%comment_author%: %comment_excerpt_URL%</li>", $types = 'comment pingback trackback', $status = '1', $ids = '', $order = 'DESC', $offset = 0, $date_format = 'm/d/Y', $include_passworded_posts = false )
- $limit : The number of comments to list/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 comment objects without outputting anything.
- $mode : The manner in which comments are to be considered, either ‘comments’, ‘recentcommenters’, or ‘topcommenters’
- $types : A space-separated list of comment types to include; can be any combination of ‘comment’, ‘pingback’, and/or ‘trackback’
- $status : A space-separated list of comment status values to include; can be any combination of ‘1’ (approved comments), ‘0’ (unapproved comments), and/or ‘spam’ (spam, obviously).
- $ids : A space-separated list of post IDs with which to limit the search for the comment listings
- $order : The order with which the comment listing should be sorted, either ‘ASC’ (for ascending) or ‘DESC’ (for descending); default is ‘DESC’
- $offset : The number of comments to skip; default is 0
- $date_format : Date format string, PHP-style, if different from the blog’s default date-format string
- $include_passworded_posts : A boolean value, either ‘true’ or ‘false’, indicating if passworded posts should be considered in the comment search
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 Comments <?php c2c_get_recent_comments(3); ?> </ul>
Would output something like:
- Recent Comments
- John: Ha! That was so funny I…
- Sarah: I’ve got a story that will…
- John: Haven’t I told you the story…
<ul>Recent Commenters <?php c2c_get_recent_commenters(3); ?> </ul>
Would output something like:
- Recently Commenters
- John: Ha! That was so funny I…
- Sarah: I’ve got a story that will…
- Tom Jones: Haven’t you heard of the red…
<ul>Top Commenters <?php c2c_get_top_commenters(3); ?> </ul>
Would output something like:
But what you may really want is to run the Recent Comments calls and customize the listing output. That’s where the percent substitution tags come into play. The $format argument to each of the functions above is a string that represents how each commentt 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 only want to list the most recent comment, to include the comment author’s name linked to that person’s site (if they provided an URL), plus a short excerpt of the post, plus the title of the post the comment appeared in linked to the post itself. You’d do this:
<ul> <?php c2c_get_recent_comments(1, "<li>%comment_author% said \"%comment_excerpt%\" in <br />%post_URL%</li>"); ?> </ul>
Which would output something like:
- Somebody said “Here is a comment to your…” in
Hello world
- 30 Mar 2005 : v0.9 — Released to the public
Copyright (c) 2005 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.
82 replies on “Plugin: Customizable Comment Listings”
Hi and thanks for the plug-in. I’d like to format my comments by removing the inverted commas from around the comment excerpt, is that possible?
Another question:
I’m trying to exclude my comments fromt the recent comment list and have added my email address “ua.moc.skrownoitomnull@nhoj” to the following but can’t get it to exclude my comments. I’ve double checked the email address. Any ideas?
Thanks,
JD
/* ================= CONFIGURATION SECTION ============================ */
// The field you want to base the identity of the commenter on; must be one of
// ‘comment_author’, ‘comment_author_url’, or ‘comment_author_email’
$identity_field = ‘comment_author_email’;
// If you would like to omit yourself or others from the listings, put the $identity_field values to exclude here:
// i.e. if the $identity_field is ‘comment_author’, then use names; if ‘comment_author_email’, use email addresses
// examples:
// $exclude_from_listing = array(‘Me’, ‘Joe Bob’, ‘Sue’);
// $exclude_from_listing = array(‘gro.etisymnull@em‘, ‘moc.eslenull@ydobemos‘);
// Should exclusions be done in the first place?
$do_exclusions = true;
// NOTE: Exclusions are not performed if $do_exclusions is false
$exclude_from_listing = array(‘ua.moc.skrownoitomnull@nhoj‘);
// Open links in new browser window?
$open_in_new_window = false;
I seem to be having an issue with links in comments (that appear in the exerpt returned) and viewing in IE6 (I know, I know…). It looks like IE6 is choking on the url, even though it’s no longer an <a href by the time the exerpt is passed back to be used in the sidebar.
[…] » Plugin: Customizable Comment Listings « « Blog Archive coffee2code.com (tags: blogging CustomizableCommentListings) […]
Hi Scott,
I love this plugin and its the only one I’ve found that is so flexible that it just fits my needs perfectly. I’ve got a small problem though lol 🙂
How do I get rid of the bullet in my comments? I’m using the following code:
Delete my comments Scott, I sorted the problem out. Love the plugin 🙂
hey! thank you very much for this plug-in. my blog is in hebrew and it’s working great!
[…] Name:Customizable Comment Listings Author:Scott Reilly Download Here Display Recent Comments, Pingbacks, and/or Trackbacks, as well as other comment listings using the comment and/or post information of your choosing in an easily customizable manner. You can narrow comment searches by specifying post IDs, comment types, and/or comment status, among other things. Installation:Download the file customizable-comment-listings.zip and unzip it into your /wp-content/plugins/ directory. -OR- Copy and paste the the code ( customizable-comment-listings.phps ) into a file called customizable-comment-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 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 your index.php […]
Great plugin.
But messes up with the ‘draft control’ plugin from www.kenvillines.com/
^Sorry, forgot to mention that it gives wrong links to the comments (gives instead other existing permalinks), if draft control is enabled.
Regards
I am trying to use this with the custom post listings and getting the following error:
Fatal error: Cannot redeclare c2c_comment_count() (previously declared in /home/xxxx/public_html/xxxx/wp-content/plugins/customizable-comment-listings.php:197) in /home/xxxx/public_html/xxxx/wp-content/plugins/customizable-post-listings.php on line 13
I saw that this was going to be fixed last year so both plugins could be used. Has this issue been fixed yet? Is there a quick fix? I really want to use this plugin but don’t want to give up the CPL plugin either.
Thanks!
Think you can disregard the two earlier comments. I have found that it is FeedWordPress plugin that is causing the trouble for the Customizable Comment Listings plugin. (Post with feeds linking to original blog gives bad permalinks for Comment Listings – workaround can be to add feeds to a specific category, not showing that category on frontpage, and disable Comment Listings when that category is active….not optimal, but it works)
Just installed “Customizable Comments Listings” on my blog together with your “Customizable Post Listings”.
I had a problem very similar to what Jeff reported on April 1st, 2005. The solution you suggested (renaming the function) worked fine.
Great plugin. Thanks.
Jean-Luc
great plugin, thanks
[…] Download Here […]
Hi,
Exclusions not performed
Hi Scott,
listen, I use this code:
%comment_author% said \”%comment_excerpt%\” in %post_URL%”); ?>
I wanted to know how I exclude more comments on the same category, I want only the most recent comment in that category.
For Example (it works in this way):
“Jack said “Here is a comment to your…” in Hello world”
“Elen said “Here is a comment to your…” in Hello world”
“Mary said “Here is a comment to your…” in Photoes”
I would like in this way:
“Jack said “Here is a comment to your…” in Hello world”
“Mary said “Here is a comment to your…” in Photoes”
Is it possible? How ? If It is not possible, don’t worry, however it is good :))
Is it possible? How ?
banche ed istituto di credito
Can you extend your code to return an empty () when the return is empty?
How ever I set $include_passworded_posts (true or false), all comments show up…
Using default theme
Any ideas?
The best way is to www.ghost13.org/d/tutti-testo/tutti-testo.html tutti testo and read all the information available on different tutti testo websites. Go get it!
The best way is to www.ghost13.org/d/aspirapolvere/aspirapolvere.html aspirapolvere and read all the information available on different aspirapolvere websites. Go get it!
The best way is to www.ghost13.org/d/camini/camini.html camini and read all the information available on different camini websites. Go get it!
The best way is to antiquariato.litect.org/antiquariato.html antiquariato and read all the information available on different antiquariato websites. Go get it!
Hi.The best way is to ghost13.scmd.at/tutti-testo.html tutti testo and read all the information available on different tutti testo
Regarding to the issue “Cannot redeclare c2c_comment_count()”, the solution is pretty easy and I wonder why no-one already thought about it. It’s like a C include.
Just add before the function declaration in the two plugins you want to activate :
if (!function_exists(‘c2c_comment_count’))
Works for PHP 3 >= 3.0.7, PHP 4, PHP 5
Scott, thank you for the great plugins. Can you update them with this fix ?
[…] Plug-in-ul este disponibil pentru download la www.coffee2code.com […]
[…] Customizable Comment Listings: Muestra los ?ltimos comentarios, pingbacks, y/o trackbacks. […]
[…] also included the following plugins with the theme (in the plugins folder): Customizable Comment Listings, WP-Email, and WP-Print. You don’t have to install the plugins — the theme works fine without […]
[…] following plugins are included with the theme (in the plugins folder): Customizable Comment Listings, WP-Email, and WP-Print. You don’t have to install the plugins — the theme works fine without […]
[…] Customizable Comment Listings WordPress Plugin […]