comments_template
最后更新于:2021-11-26 01:01:29
apply_filters( ‘comments_template’, string $theme_template )
Filters the path to the theme template file used for the comments template.
参数
- $theme_template
-
(string)
The path to the theme template file.
源文件
文件: gc-includes/comment-template.php
<?php function my_plugin_comment_template( $comment_template ) { global $post; if ( !( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) { return; } if($post->post_type == 'business'){ // assuming there is a post type called business return dirname(__FILE__) . '/reviews.php'; } } add_filter( "comments_template", "my_plugin_comment_template" ); ?>