WordPress load comment template tag: Comments_ template

WordPress template tags comments_ Template first attempts to load the comment template comments.php , if comments.php If it does not exist, the default comment area HTML will be output

comments_template( string $file = '/comments.php', bool $separate_comments = false )

Function parameters


String value, optional, default value is/ comments.php

You can specify the comment template that needs to be loaded instead of being a comment template comments.php

$separate_ comments

Boolean value, optional. The default value is false

Whether to output comments according to the type of comments is almost useless.

comments_ The template tag is usually used in single.php and page.php In the main loop of, it is used to output the comment list and comment form.

Extended reading

comments_ The template() function is located in: WP includes / comment- template.php

Related Tags:

  • get_ header()
  • get_ sidebar()
  • get_ template_ part()
  • get_ search_ form()
  • get_ footer()
Related Article
WordPress comment date tag: comment_date

WordPress template tags comment_ Date is used to output the date of a comment, usually in a custom comment template. Read more

WordPress comment summary tag: comment_excerpt

WordPress template tags comment_ Excerpt is used to output the summary of comments. The default output is 20 characters. It Read more

WordPress comment time tag: comment_time

WordPress template tags comment_ Time is used to output the publishing time of the current comment, which is the same Read more

WordPress RSS format comment author name tag: comment_author_rss

WordPress template tags comment_ author_ RSS is used to output the comment author name in RSS format, which has no Read more

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image