[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> comment-template.php (summary)

Comment template functions These functions are meant to live inside of the WordPress loop.

File Size: 2648 lines (91 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 wp-includes/theme-compat/comments.php

Defines 53 functions

  get_comment_author()
  comment_author()
  get_comment_author_email()
  comment_author_email()
  comment_author_email_link()
  get_comment_author_email_link()
  get_comment_author_link()
  comment_author_link()
  get_comment_author_IP()
  comment_author_IP()
  get_comment_author_url()
  comment_author_url()
  get_comment_author_url_link()
  comment_author_url_link()
  comment_class()
  get_comment_class()
  get_comment_date()
  comment_date()
  get_comment_excerpt()
  comment_excerpt()
  get_comment_ID()
  comment_ID()
  get_comment_link()
  get_comments_link()
  comments_link()
  get_comments_number()
  comments_number()
  get_comments_number_text()
  get_comment_text()
  comment_text()
  get_comment_time()
  comment_time()
  get_comment_type()
  comment_type()
  get_trackback_url()
  trackback_url()
  trackback_rdf()
  comments_open()
  pings_open()
  wp_comment_form_unfiltered_html_nonce()
  comments_template()
  comments_popup_link()
  get_comment_reply_link()
  comment_reply_link()
  get_post_reply_link()
  post_reply_link()
  get_cancel_comment_reply_link()
  cancel_comment_reply_link()
  get_comment_id_fields()
  comment_id_fields()
  comment_form_title()
  wp_list_comments()
  comment_form()

Functions
Functions that are not part of a class:

get_comment_author( $comment_ID = 0 )   X-Ref
Retrieve the author of the current comment.

If the comment has an empty comment_author field, then 'Anonymous' person is
assumed.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string The comment author
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to retrieve the author.

comment_author( $comment_ID = 0 )   X-Ref
Displays the author of the current comment.

since: 0.71
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author.

get_comment_author_email( $comment_ID = 0 )   X-Ref
Retrieve the email of the author of the current comment.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string The current comment author's email
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's email.

comment_author_email( $comment_ID = 0 )   X-Ref
Display 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.

since: 0.71
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's email.

comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null )   X-Ref
Display 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.

since: 0.71
since: 4.6.0 Added the `$comment` parameter.
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.

get_comment_author_email_link( $linktext = '', $before = '', $after = '', $comment = null )   X-Ref
Return 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.

since: 2.7.0
since: 4.6.0 Added the `$comment` parameter.
return: string HTML markup for the comment author email link. By default, the email address is obfuscated
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.

get_comment_author_link( $comment_ID = 0 )   X-Ref
Retrieve 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.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string The comment author name or HTML link for author's URL.
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's link.

comment_author_link( $comment_ID = 0 )   X-Ref
Display the html link to the url of the author of the current comment.

since: 0.71
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's link.

get_comment_author_IP( $comment_ID = 0 )   X-Ref
Retrieve the IP address of the author of the current comment.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string Comment author's IP address.
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's IP address.

comment_author_IP( $comment_ID = 0 )   X-Ref
Display the IP address of the author of the current comment.

since: 0.71
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's IP address.

get_comment_author_url( $comment_ID = 0 )   X-Ref
Retrieve the url of the author of the current comment.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string Comment author URL.
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's URL.

comment_author_url( $comment_ID = 0 )   X-Ref
Display the url of the author of the current comment.

since: 0.71
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
param: int|WP_Comment $comment_ID Optional. WP_Comment or the ID of the comment for which to print the author's URL.

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.

since: 1.5.0
since: 4.6.0 Added the `$comment` parameter.
return: string The HTML link between the $before and $after parameters.
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.

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.

since: 0.71
since: 4.6.0 Added the `$comment` parameter.
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.

comment_class( $class = '', $comment = null, $post_id = null, $echo = true )   X-Ref
Generates semantic classes for each comment element.

since: 2.7.0
since: 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
return: string If `$echo` is false, the class will be returned. Void otherwise.
param: string|array   $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           $echo     Optional. Whether to echo or return the output.

get_comment_class( $class = '', $comment_id = null, $post_id = null )   X-Ref
Returns the classes for the comment div as an array.

since: 2.7.0
since: 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
return: array An array of classes.
param: string|array   $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.

get_comment_date( $d = '', $comment_ID = 0 )   X-Ref
Retrieve the comment date of the current comment.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string The comment's date.
param: string          $d          Optional. The format of the date. Default user's setting.
param: int|WP_Comment  $comment_ID WP_Comment or ID of the comment for which to get the date.

comment_date( $d = '', $comment_ID = 0 )   X-Ref
Display the comment date of the current comment.

since: 0.71
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
param: string         $d          Optional. The format of the date. Default user's settings.
param: int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the date.

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.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string The possibly truncated comment excerpt.
param: int|WP_Comment $comment_ID  WP_Comment or ID of the comment for which to get the excerpt.

comment_excerpt( $comment_ID = 0 )   X-Ref
Display the excerpt of the current comment.

since: 1.2.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
param: int|WP_Comment $comment_ID  WP_Comment or ID of the comment for which to print the excerpt.

get_comment_ID()   X-Ref
Retrieve the comment id of the current comment.

since: 1.5.0
return: int The comment ID.

comment_ID()   X-Ref
Display the comment id of the current comment.

since: 0.71

get_comment_link( $comment = null, $args = array()   X-Ref
Retrieve the link to a 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.
return: string The permalink to the given comment.
param: WP_Comment|int|null $comment Comment to retrieve. Default current comment.
param: array               $args {

get_comments_link( $post_id = 0 )   X-Ref
Retrieves the link to the current post comments.

since: 1.5.0
return: string The link to the comments.
param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.

comments_link( $deprecated = '', $deprecated_2 = '' )   X-Ref
Display the link to the current post comments.

since: 0.71
param: string $deprecated   Not Used.
param: string $deprecated_2 Not Used.

get_comments_number( $post_id = 0 )   X-Ref
Retrieves the amount of comments a post has.

since: 1.5.0
return: string|int If the post exists, a numeric string representing the number of comments
param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is the global `$post`.

comments_number( $zero = false, $one = false, $more = false, $deprecated = '' )   X-Ref
Display the language string for the number of comments the current post has.

since: 0.71
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: string $deprecated Not used.

get_comments_number_text( $zero = false, $one = false, $more = false )   X-Ref
Display the language string for the number of comments the current post has.

since: 4.0.0
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.

get_comment_text( $comment_ID = 0, $args = array()   X-Ref
Retrieve the text of the current comment.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string The comment content.
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.

comment_text( $comment_ID = 0, $args = array()   X-Ref
Display the text of the current comment.

since: 0.71
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
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. Default empty.

get_comment_time( $d = '', $gmt = false, $translate = true )   X-Ref
Retrieve the comment time of the current comment.

since: 1.5.0
return: string The formatted time.
param: string $d         Optional. The format of the time. Default user's settings.
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).

comment_time( $d = '' )   X-Ref
Display the comment time of the current comment.

since: 0.71
param: string $d Optional. The format of the time. Default user's settings.

get_comment_type( $comment_ID = 0 )   X-Ref
Retrieve the comment type of the current comment.

since: 1.5.0
since: 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
return: string The comment type.
param: int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the type.

comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false )   X-Ref
Display the comment type of the current comment.

since: 0.71
param: string $commenttxt   Optional. String to display for comment type. Default false.
param: string $trackbacktxt Optional. String to display for trackback type. Default false.
param: string $pingbacktxt  Optional. String to display for pingback type. Default false.

get_trackback_url()   X-Ref
Retrieve 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.

since: 1.5.0
return: string The trackback URL after being filtered.

trackback_url( $deprecated_echo = true )   X-Ref
Display the current post's trackback URL.

since: 0.71
return: void|string Should only be used to echo the trackback URL, use get_trackback_url()
param: bool $deprecated_echo Not used.

trackback_rdf( $deprecated = '' )   X-Ref
Generate and display the RDF for the trackback information of current post.

Deprecated in 3.0.0, and restored in 3.0.1.

since: 0.71
param: int $deprecated Not used (Was $timezone = 0).

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.

since: 1.5.0
return: bool True if the comments are open.
param: int|WP_Post $post_id Post ID or WP_Post object. Default current post.

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.

since: 1.5.0
return: bool True if pings are accepted
param: int|WP_Post $post_id Post ID or WP_Post object. Default current post.

wp_comment_form_unfiltered_html_nonce()   X-Ref
Display 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
Load 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.

since: 1.5.0
param: string $file              Optional. The file to load. Default '/comments.php'.
param: bool   $separate_comments Optional. Whether to separate the comments by comment type.

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.

since: 0.71
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.

get_comment_reply_link( $args = array()   X-Ref
Retrieve HTML content for reply to comment link.

since: 2.7.0
since: 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
return: string|false|null Link to show comment form, if successful. False, if comments are closed.
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.

comment_reply_link( $args = array()   X-Ref
Displays the HTML content for reply to comment link.

since: 2.7.0
param: array       $args    Optional. Override default options.
param: int         $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.

get_post_reply_link( $args = array()   X-Ref
Retrieve HTML content for reply to post link.

since: 2.7.0
return: string|false|null Link to show comment form, if successful. False, if comments are closed.
param: array $args {
param: int|WP_Post $post    Optional. Post ID or WP_Post object the comment is going to be displayed on.

post_reply_link( $args = array()   X-Ref
Displays the HTML content for reply to post link.

since: 2.7.0
param: array       $args Optional. Override default options,
param: int|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on.

get_cancel_comment_reply_link( $text = '' )   X-Ref
Retrieve HTML content for cancel comment reply link.

since: 2.7.0
return: string
param: string $text Optional. Text to display for cancel reply link. Default empty.

cancel_comment_reply_link( $text = '' )   X-Ref
Display HTML content for cancel comment reply link.

since: 2.7.0
param: string $text Optional. Text to display for cancel reply link. Default empty.

get_comment_id_fields( $id = 0 )   X-Ref
Retrieve hidden input HTML for replying to comments.

since: 3.0.0
return: string Hidden input HTML for replying to comments
param: int $id Optional. Post ID. Default current post ID.

comment_id_fields( $id = 0 )   X-Ref
Output hidden input HTML for replying to comments.

since: 2.7.0
param: int $id Optional. Post ID. Default current post ID.

comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true )   X-Ref
Display text based on comment reply status.

Only affects users with JavaScript disabled.

since: 2.7.0
param: string $noreplytext  Optional. Text to display when not replying to a comment.
param: string $replytext    Optional. Text to display when replying to a comment.
param: string $linktoparent Optional. Boolean to control making the author's name a link

wp_list_comments( $args = array()   X-Ref
List comments.

Used in the comments.php template to list comments for a particular post.

since: 2.7.0
param: string|array $args {
param: array $comments Optional. Array of WP_Comment objects.

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.

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.
param: array       $args {
param: int|WP_Post $post_id Post ID or WP_Post object to generate the form for. Default current post.



Generated: Sun Sep 22 01:00:03 2019 Cross-referenced by PHPXref 0.7.1