您可以使用comments_template
筛选以更改您的CPT将用于注释的文件。
function wpse_plugin_comment_template( $comment_template ) {
global $post;
if ( !( is_singular() && ( have_comments() || \'open\' == $post->comment_status ) ) ) {
// leave the standard comments template for standard post types
return;
}
if($post->post_type == \'business\'){ // assuming there is a post type called business
// This is where you would use your commentsnew.php, or review.php
return dirname(__FILE__) . \'/review.php\';
}
}
// throw this into your plugin or your functions.php file to define the custom comments template.
add_filter( "comments_template", "wpse_plugin_comment_template" );