WordPress V2.xTemplate Tag Reference Guide as of Version 2.x
Presented by:
Comment Tags
Comment Countcomments_number();
Displays the total number of comments, Trackbacks, and Pingbacks for a post. This tag must be within The Loop.
<?php comments_number('zero', 'one', 'more', 'number'); ?>
zero
Text to be displayed if there is no comments
<?php comments_number('No Comments', 'one', 'more', 'number'); ?>
String
one
Text to be displayed if there is 1 comment
<?php comments_number('zero', '1 Comment', 'more', 'number'); ?>
String
more
Text to be displayed if there more than 1 comment. % is replaced by the number of comments, so '% so far' is displayed as "5 so far" when there are five comments.
<?php comments_number('zero', 'one', '% Comments', 'number'); ?>
String
number
Number of comments. Defaults to the total actual number of comments
<?php comments_number('zero', 'one', 'more', '5'); ?>
Integer
Link to Post Commentscomments_link();
Displays the URL to a post's comments. This tag must be within The Loop, or the loop set up for comments.
<?php comments_link(); ?>
No Parameters
Link to RSS Feed of Post Commentscomments_rss_link();
Much like an RSS feed for your WordPress blog, this feature will display a link to the RSS feed for a given post's comments. By implementing the feature, your readers will be able to track the comment thread for a given post, perhaps encouraging them to stay connected to the conversation.
<?php comments_rss_link('text', 'file'); ?>
text
Link text for the comments RSS link. Defaults to 'Comments RSS'
<?php comments_rss_link('RSS', 'file'); ?>
String
file
The file the link points to. Defaults to 'wp-commentsrss2.php'.
<?php comments_rss_link('text', 'wp-commentsrss2.php'); ?>
String
JavaScript for Pop-Up Windowcomments_popup_script();
Outputs the JavaScript code for a comments popup window. Used in tandem with comments_popup_link(), this tag can be used anywhere within a template, though is typically placed within the <head> portion of a page.
<?php comments_popup_script(wiph, height); ?>
wiph
The wiph of the popup window. Defaults to 400 (pixels).
<?php comments_popup_script(300, height); ?>
Integer
height
The height of the popup window. Defaults to 400 (pixels).
<?php comments_popup_script(wiph, 300); ?>
Integer
Link to Pop-Up Windowcomments_popup_script();
Displays a link to the comments popup window if comments_popup_script() is used, otherwise it displays a normal link to comments. This tag must be within The Loop, or a comment loop, and it does nothing if is_single() or is_page() is true (even when within The Loop).
<?php comments_popup_link ('zero','one','more','CSSclass','none'); ?>
zero
Text to display if there is no comments.
<?php comments_popup_link ('No Comments','one','more','CSSclass'); ?>
String
one
Text to display if there is one comment.
<?php comments_popup_link ('zero','1 Comment','more','CSSclass'); ?>
String
more
Text to dislay if there is more than one comment.
<?php comments_popup_link ('zero','one','% Comments','CSSclass'); ?>
String
CSSclass
CSS (stylesheet) class for the link. This has no default value.
<?php comments_popup_link ('zero','one','more','popup-link'); ?>
String
none
Comments off.
<?php comments_popup_link ('none'); ?>
String
Comment IDcomment_ID();
Displays the numeric ID of a comment. This tag must be within The Loop, or a comment loop.
<?php comment_ID(); ?>
No Parameters
Author of Commentcomment_author();
Displays the comment author name; that is, the one supplied by the commenter. If no name is provided (and "User must fill out name and email" is not enabled under Discussion Options), WordPress will assign "Anonymous" as comment author. This tag must be within The Loop, or a comment loop.
<?php comment_author(); ?>
No Parameters
IP Address of Comment Authorcomment_author_IP();
Displays the comment author's IP address. This tag must be within The Loop, or a comment loop.
<?php comment_author_IP(); ?>
No Parameters
Email of Comment Authorcomment_author_email();
Displays the comment author's email address, not linked. An email address must be provided if "User must fill out name and email" is enabled under Discussion Options. This tag must be within The Loop, or a comment loop.
<?php comment_author_email(); ?>
No Parameters
Website URL of Comment Authorcomment_author_url();
Displays the comment author's URL (usually their web site), not linked. This tag must be within The Loop, or a comment loop.
<?php comment_author_url(); ?>
No Parameters
Mailto Link to Comment Authorcomment_author_email_link();
Displays the comment author's email address, as a mailto link. An email address must be provided if "User must fill out name and email" is enabled under Discussion Options. This tag must be within The Loop, or a comment loop.
<?php comment_author_email_link('linktext', 'before', 'after'); ?>
linktext
Link text for the email link. Default is the comment author's email address.
<?php comment_author_email_link('Email', 'before', 'after'); ?>
String
before
Text to display before the link. There is no default.
<?php comment_author_email_link('linktext', '»', 'after'); ?>
String
after
Text to display after the link. There is no default.
<?php comment_author_email_link('linktext', 'before', '«'); ?>
String
Link to Website URL of Comment Authorcomment_author_link();
Displays the comment author's name linked to his/her URL, if one was provided. This tag must be within The Loop, or a comment loop.
<?php comment_author_link(); ?>
No Parameters
Type of Commentcomment_type();
Displays the type of comment (regular comment, Trackback or Pingback) a comment entry is. This tag must be within The Loop, or a comment loop.
<?php comment_type('comment', 'trackback', 'pingback'); ?>
comment
Text to describe a comment type comment. Defaults to 'Comment'
<?php comment_type('Comment!', 'trackback', 'pingback'); ?>
String
trackback
Text to describe a Trackback type comment. Defaults to 'Trackback'.
<?php comment_type('comment', 'Trackback!', 'pingback'); ?>
String
pingback
Text to describe a Pingback type comment. Defaults to 'Pingback'.
<?php comment_type('comment', 'trackback', 'Pingback!'); ?>
String
Comment Textcomment_text();
Displays the text of a comment. This tag must be within The Loop, or a comment loop.
<?php comment_text(); ?>
No Parameters
Comment Excerptcomment_excerpt();
Displays an excerpt (maximum of 20 words) of a comment's text. This tag will work within a comment loop.
<?php comment_excerpt(); ?>
No Parameters
Date of Commentcomment_date();
Displays the date a comment was posted. This tag must be within The Loop, or a comment loop.
<?php comment_date(); ?>
d
Formatting for the date. Defaults to the date format set in WordPress.
<?php comment_date('n-j-Y'); ?>
String
Time of Commentcomment_time();
Displays the time a comment was posted. This tag must be within The Loop, or a comment loop.
<?php comment_time(); ?>
d
Formatting for the time. Defaults to the time format set in WordPress.
<?php comment_time('H:i:s'); ?>
String
Comment Author's Name Formatted for RSScomment_author_rss();
Displays the comment author's name formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.
<?php comment_author_rss(); ?>
No Parameters
Comment Text Formatted for RSScomment_text_rss();
Displays the text of a comment formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.
<?php comment_text_rss(); ?>
No Parameters
Comment Link Formatted for RSScomment_link_rss();
Displays the URL to an entry's comments formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.
<?php comment_link_rss(); ?>
No Parameters
Comment Permalink Formatted for RSSpermalink_comments_rss();
Displays the permalink to the post to which a comment belongs, formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.
<?php permalink_comments_rss(); ?>
No Parameters