/ Published in: PHP
WP comments
Expand |
Embed | Plain Text
<?php //First add an empty file your template folder (sub theme), nothing in. No code, nothing. Just give it a name like "no-comments-please.php" and upload it to your server. //After that you can add something like this to your functions.php in order to call the file when pages are called: add_filter( 'comments_template', 'remove_comments_template_on_pages', 11 ); function remove_comments_template_on_pages( $file ) { if ( is_page() ) $file = STYLESHEETPATH . '/no-comments-please.php'; return $file; } //After that comments will be removed from all pages. If you like you can enhance the function to do whatever you want. ?>
You need to login to post a comment.
