首页 WordPress函数大全 comments_template()

comments_template()

2020-05-01 / 6511阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

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

Loads the comment template specified in $file.

描述

Will not display the comments template if not>‘comments_array’ filter hook with the list of comments and the post ID respectively.

The $file path is passed through a filter hook called ‘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.

参数

$file

(string)
(Optional)
The file to load.

Default value: '/comments.php'

$separate_comments

(bool)
(Optional)
Whether to separate the comments by comment type.

Default value: false

大家谈论
    我的见解