[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
Comment template functions These functions are meant to live inside of the WordPress loop.
File Size: | 2748 lines (96 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 1 file wp-includes/theme-compat/comments.php |
get_comment_author( $comment_ID = 0 ) X-Ref |
Retrieves the author of the current comment. If the comment has an empty comment_author field, then 'Anonymous' person is assumed. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to retrieve the author. return: string The comment author since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_author( $comment_ID = 0 ) X-Ref |
Displays the author of the current comment. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author. since: 0.71 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
get_comment_author_email( $comment_ID = 0 ) X-Ref |
Retrieves the email of the author of the current comment. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's email. return: string The current comment author's email since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_author_email( $comment_ID = 0 ) X-Ref |
Displays the email of the author of the current global $comment. Care should be taken to protect the email address and assure that email harvesters do not capture your commenter's email address. Most assume that their email address will not appear in raw form on the site. Doing so will enable anyone, including those that people don't want to get the email address and use it for their own means good and bad. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's email. since: 0.71 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) X-Ref |
Displays the HTML email link to the author of the current comment. Care should be taken to protect the email address and assure that email harvesters do not capture your commenter's email address. Most assume that their email address will not appear in raw form on the site. Doing so will enable anyone, including those that people don't want to get the email address and use it for their own means good and bad. param: string $linktext Optional. Text to display instead of the comment author's email address. param: string $before Optional. Text or HTML to display before the email link. Default empty. param: string $after Optional. Text or HTML to display after the email link. Default empty. param: int|WP_Comment $comment Optional. Comment ID or WP_Comment object. Default is the current comment. since: 0.71 since: 4.6.0 Added the `$comment` parameter. |
get_comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null ) X-Ref |
Returns the HTML email link to the author of the current comment. Care should be taken to protect the email address and assure that email harvesters do not capture your commenter's email address. Most assume that their email address will not appear in raw form on the site. Doing so will enable anyone, including those that people don't want to get the email address and use it for their own means good and bad. param: string $linktext Optional. Text to display instead of the comment author's email address. param: string $before Optional. Text or HTML to display before the email link. Default empty. param: string $after Optional. Text or HTML to display after the email link. Default empty. param: int|WP_Comment $comment Optional. Comment ID or WP_Comment object. Default is the current comment. return: string HTML markup for the comment author email link. By default, the email address is obfuscated since: 2.7.0 since: 4.6.0 Added the `$comment` parameter. |
get_comment_author_link( $comment_ID = 0 ) X-Ref |
Retrieves the HTML link to the URL of the author of the current comment. Both get_comment_author_url() and get_comment_author() rely on get_comment(), which falls back to the global comment variable if the $comment_ID argument is empty. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's link. return: string The comment author name or HTML link for author's URL. since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_author_link( $comment_ID = 0 ) X-Ref |
Displays the HTML link to the URL of the author of the current comment. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's link. since: 0.71 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
get_comment_author_IP( $comment_ID = 0 ) X-Ref |
Retrieves the IP address of the author of the current comment. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's IP address. return: string Comment author's IP address, or an empty string if it's not available. since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_author_IP( $comment_ID = 0 ) X-Ref |
Displays the IP address of the author of the current comment. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's IP address. since: 0.71 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
get_comment_author_url( $comment_ID = 0 ) X-Ref |
Retrieves the URL of the author of the current comment, not linked. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's URL. return: string Comment author URL, if provided, an empty string otherwise. since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_author_url( $comment_ID = 0 ) X-Ref |
Displays the URL of the author of the current comment, not linked. param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's URL. since: 0.71 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) X-Ref |
Retrieves the HTML link of the URL of the author of the current comment. $linktext parameter is only used if the URL does not exist for the comment author. If the URL does exist then the URL will be used and the $linktext will be ignored. Encapsulate the HTML link between the $before and $after. So it will appear in the order of $before, link, and finally $after. param: string $linktext Optional. The text to display instead of the comment param: string $before Optional. The text or HTML to display before the email link. param: string $after Optional. The text or HTML to display after the email link. param: int|WP_Comment $comment Optional. Comment ID or WP_Comment object. return: string The HTML link between the $before and $after parameters. since: 1.5.0 since: 4.6.0 Added the `$comment` parameter. |
comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) X-Ref |
Displays the HTML link of the URL of the author of the current comment. param: string $linktext Optional. Text to display instead of the comment author's param: string $before Optional. Text or HTML to display before the email link. param: string $after Optional. Text or HTML to display after the email link. param: int|WP_Comment $comment Optional. Comment ID or WP_Comment object. since: 0.71 since: 4.6.0 Added the `$comment` parameter. |
comment_class( $css_class = '', $comment = null, $post_id = null, $display = true ) X-Ref |
Generates semantic classes for each comment element. param: string|string[] $css_class Optional. One or more classes to add to the class list. param: int|WP_Comment $comment Comment ID or WP_Comment object. Default current comment. param: int|WP_Post $post_id Post ID or WP_Post object. Default current post. param: bool $display Optional. Whether to print or return the output. return: void|string Void if `$display` argument is true, comment classes if `$display` is false. since: 2.7.0 since: 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object. |
get_comment_class( $css_class = '', $comment_id = null, $post_id = null ) X-Ref |
Returns the classes for the comment div as an array. param: string|string[] $css_class Optional. One or more classes to add to the class list. Default empty. param: int|WP_Comment $comment_id Comment ID or WP_Comment object. Default current comment. param: int|WP_Post $post_id Post ID or WP_Post object. Default current post. return: string[] An array of classes. since: 2.7.0 since: 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. |
get_comment_date( $format = '', $comment_ID = 0 ) X-Ref |
Retrieves the comment date of the current comment. param: string $format Optional. PHP date format. Defaults to the 'date_format' option. param: int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date. return: string The comment's date. since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_date( $format = '', $comment_ID = 0 ) X-Ref |
Displays the comment date of the current comment. param: string $format Optional. PHP date format. Defaults to the 'date_format' option. param: int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the date. since: 0.71 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
get_comment_excerpt( $comment_ID = 0 ) X-Ref |
Retrieves the excerpt of the given comment. Returns a maximum of 20 words with an ellipsis appended if necessary. param: int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the excerpt. return: string The possibly truncated comment excerpt. since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_excerpt( $comment_ID = 0 ) X-Ref |
Displays the excerpt of the current comment. param: int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the excerpt. since: 1.2.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
get_comment_ID() X-Ref |
Retrieves the comment ID of the current comment. return: string The comment ID as a numeric string. since: 1.5.0 |
comment_ID() X-Ref |
Displays the comment ID of the current comment. since: 0.71 |
get_comment_link( $comment = null, $args = array() X-Ref |
Retrieves the link to a given comment. param: WP_Comment|int|null $comment Comment to retrieve. Default current comment. param: array $args { return: string The permalink to the given comment. since: 1.5.0 since: 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object. Added `$cpage` argument. |
get_comments_link( $post_id = 0 ) X-Ref |
Retrieves the link to the current post comments. param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. return: string The link to the comments. since: 1.5.0 |
comments_link( $deprecated = '', $deprecated_2 = '' ) X-Ref |
Displays the link to the current post comments. param: string $deprecated Not Used. param: string $deprecated_2 Not Used. since: 0.71 |
get_comments_number( $post_id = 0 ) X-Ref |
Retrieves the amount of comments a post has. param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`. return: string|int If the post exists, a numeric string representing the number of comments since: 1.5.0 |
comments_number( $zero = false, $one = false, $more = false, $post_id = 0 ) X-Ref |
Displays the language string for the number of comments the current post has. param: string|false $zero Optional. Text for no comments. Default false. param: string|false $one Optional. Text for one comment. Default false. param: string|false $more Optional. Text for more than one comment. Default false. param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`. since: 0.71 since: 5.4.0 The `$deprecated` parameter was changed to `$post_id`. |
get_comments_number_text( $zero = false, $one = false, $more = false, $post_id = 0 ) X-Ref |
Displays the language string for the number of comments the current post has. param: string $zero Optional. Text for no comments. Default false. param: string $one Optional. Text for one comment. Default false. param: string $more Optional. Text for more than one comment. Default false. param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`. return: string Language string for the number of comments a post has. since: 4.0.0 since: 5.4.0 Added the `$post_id` parameter to allow using the function outside of the loop. |
get_comment_text( $comment_ID = 0, $args = array() X-Ref |
Retrieves the text of the current comment. param: int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the text. param: array $args Optional. An array of arguments. Default empty array. return: string The comment content. since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. since: 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed. |
comment_text( $comment_ID = 0, $args = array() X-Ref |
Displays the text of the current comment. param: int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the text. param: array $args Optional. An array of arguments. Default empty array. since: 0.71 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
get_comment_time( $format = '', $gmt = false, $translate = true ) X-Ref |
Retrieves the comment time of the current comment. param: string $format Optional. PHP time format. Defaults to the 'time_format' option. param: bool $gmt Optional. Whether to use the GMT date. Default false. param: bool $translate Optional. Whether to translate the time (for use in feeds). return: string The formatted time. since: 1.5.0 |
comment_time( $format = '' ) X-Ref |
Displays the comment time of the current comment. param: string $format Optional. PHP time format. Defaults to the 'time_format' option. since: 0.71 |
get_comment_type( $comment_ID = 0 ) X-Ref |
Retrieves the comment type of the current comment. param: int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the type. return: string The comment type. since: 1.5.0 since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) X-Ref |
Displays the comment type of the current comment. param: string|false $commenttxt Optional. String to display for comment type. Default false. param: string|false $trackbacktxt Optional. String to display for trackback type. Default false. param: string|false $pingbacktxt Optional. String to display for pingback type. Default false. since: 0.71 |
get_trackback_url() X-Ref |
Retrieves the current post's trackback URL. There is a check to see if permalink's have been enabled and if so, will retrieve the pretty path. If permalinks weren't enabled, the ID of the current post is used and appended to the correct page to go to. return: string The trackback URL after being filtered. since: 1.5.0 |
trackback_url( $deprecated_echo = true ) X-Ref |
Displays the current post's trackback URL. param: bool $deprecated_echo Not used. return: void|string Should only be used to echo the trackback URL, use get_trackback_url() since: 0.71 |
trackback_rdf( $deprecated = '' ) X-Ref |
Generates and displays the RDF for the trackback information of current post. Deprecated in 3.0.0, and restored in 3.0.1. param: int|string $deprecated Not used (Was $timezone = 0). since: 0.71 |
comments_open( $post_id = null ) X-Ref |
Determines whether the current post is open for comments. For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook. param: int|WP_Post $post_id Post ID or WP_Post object. Default current post. return: bool True if the comments are open. since: 1.5.0 |
pings_open( $post_id = null ) X-Ref |
Determines whether the current post is open for pings. For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook. param: int|WP_Post $post_id Post ID or WP_Post object. Default current post. return: bool True if pings are accepted since: 1.5.0 |
wp_comment_form_unfiltered_html_nonce() X-Ref |
Displays form token for unfiltered comments. Will only display nonce token if the current user has permissions for unfiltered html. Won't display the token for other users. The function was backported to 2.0.10 and was added to versions 2.1.3 and above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0. Backported to 2.0.10. since: 2.1.3 |
comments_template( $file = '/comments.php', $separate_comments = false ) X-Ref |
Loads the comment template specified in $file. Will not display the comments template if not on single post or page, or if the post does not have comments. Uses the WordPress database object to query for the comments. The comments are passed through the {@see 'comments_array'} filter hook with the list of comments and the post ID respectively. The `$file` path is passed through a filter hook called {@see 'comments_template'}, which includes the TEMPLATEPATH and $file combined. Tries the $filtered path first and if it fails it will require the default comment template from the default theme. If either does not exist, then the WordPress process will be halted. It is advised for that reason, that the default theme is not deleted. Will not try to get the comments if the post has none. param: string $file Optional. The file to load. Default '/comments.php'. param: bool $separate_comments Optional. Whether to separate the comments by comment type. since: 1.5.0 |
comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) X-Ref |
Displays the link to the comments for the current post ID. param: false|string $zero Optional. String to display when no comments. Default false. param: false|string $one Optional. String to display when only one comment is available. Default false. param: false|string $more Optional. String to display when there are more than one comment. Default false. param: string $css_class Optional. CSS class to use for comments. Default empty. param: false|string $none Optional. String to display when comments have been turned off. Default false. since: 0.71 |
get_comment_reply_link( $args = array() X-Ref |
Retrieves HTML content for reply to comment link. param: array $args { param: int|WP_Comment $comment Comment being replied to. Default current comment. param: int|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on. return: string|false|null Link to show comment form, if successful. False, if comments are closed. since: 2.7.0 since: 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object. |
comment_reply_link( $args = array() X-Ref |
Displays the HTML content for reply to comment link. param: array $args Optional. Override default options. Default empty array. param: int|WP_Comment $comment Comment being replied to. Default current comment. param: int|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on. since: 2.7.0 |
get_post_reply_link( $args = array() X-Ref |
Retrieves HTML content for reply to post link. param: array $args { param: int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on. return: string|false|null Link to show comment form, if successful. False, if comments are closed. since: 2.7.0 |
post_reply_link( $args = array() X-Ref |
Displays the HTML content for reply to post link. param: array $args Optional. Override default options. Default empty array. param: int|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on. since: 2.7.0 |
get_cancel_comment_reply_link( $text = '' ) X-Ref |
Retrieves HTML content for cancel comment reply link. param: string $text Optional. Text to display for cancel reply link. If empty, return: string since: 2.7.0 |
cancel_comment_reply_link( $text = '' ) X-Ref |
Displays HTML content for cancel comment reply link. param: string $text Optional. Text to display for cancel reply link. If empty, since: 2.7.0 |
get_comment_id_fields( $post_id = 0 ) X-Ref |
Retrieves hidden input HTML for replying to comments. param: int $post_id Optional. Post ID. Defaults to the current post ID. return: string Hidden input HTML for replying to comments. since: 3.0.0 |
comment_id_fields( $post_id = 0 ) X-Ref |
Outputs hidden input HTML for replying to comments. Adds two hidden inputs to the comment form to identify the `comment_post_ID` and `comment_parent` values for threaded comments. This tag must be within the `<form>` section of the `comments.php` template. param: int $post_id Optional. Post ID. Defaults to the current post ID. since: 2.7.0 |
comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true ) X-Ref |
Displays text based on comment reply status. Only affects users with JavaScript disabled. param: string|false $no_reply_text Optional. Text to display when not replying to a comment. param: string|false $reply_text Optional. Text to display when replying to a comment. param: bool $link_to_parent Optional. Boolean to control making the author's name a link since: 2.7.0 |
wp_list_comments( $args = array() X-Ref |
Displays a list of comments. Used in the comments.php template to list comments for a particular post. param: string|array $args { param: WP_Comment[] $comments Optional. Array of WP_Comment objects. return: void|string Void if 'echo' argument is true, or no comments to list. since: 2.7.0 |
comment_form( $args = array() X-Ref |
Outputs a complete commenting form for use within a template. Most strings and form fields may be controlled through the `$args` array passed into the function, while you may also choose to use the {@see 'comment_form_default_fields'} filter to modify the array of default fields if you'd just like to add a new one or remove a single field. All fields are also individually passed through a filter of the {@see 'comment_form_field_$name'} where `$name` is the key used in the array of fields. param: array $args { param: int|WP_Post $post_id Post ID or WP_Post object to generate the form for. Default current post. since: 3.0.0 since: 4.1.0 Introduced the 'class_submit' argument. since: 4.2.0 Introduced the 'submit_button' and 'submit_fields' arguments. since: 4.4.0 Introduced the 'class_form', 'title_reply_before', 'title_reply_after', since: 4.5.0 The 'author', 'email', and 'url' form fields are limited to 245, 100, since: 4.6.0 Introduced the 'action' argument. since: 4.9.6 Introduced the 'cookies' default comment field. since: 5.5.0 Introduced the 'class_container' argument. |
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |