This page redirects to an external site: https://developer.wordpress.org/reference/functions/comments_template/
Languages: English • 日本語 Português do Brasil • Русский • (Add your language)
Loads the comment template. For use in single Post and Page displays. Will not work outside of single displays unless $withcomments is set to "1".
<?php comments_template( $file, $separate_comments ); ?>
Default Usage
<?php comments_template(); ?>
On some occasions you may want display your comments differently within your Theme. For this you would build an alternate file (ex. short-comments.php) and call it as follows:
<?php comments_template( '/short-comments.php' ); ?>
The path to the file used for an alternative comments template should be relative to the current theme root directory, and include any subfolders. So if the custom comments template is in a folder inside the theme, it may look like this when called:
<?php comments_template( '/custom-templates/alternative-comments.php' ); ?>
Since: 1.5.0
comments_template() is located in wp-includes/comment-template.php.
List of comment filters and actions