public
Last active

Remove comments on posts from specific category on your site using the Genesis Framework.

  • Download Gist
functions.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?php
//* Do NOT include the opening php tag
 
//* Remove post comments
add_action( 'wp_enqueue_scripts', 'custom_remove_comments' );
function custom_remove_comments() {
remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
}
 
//* Remove post comments in category ID #1
add_action( 'wp_enqueue_scripts', 'custom_remove_comments' );
function custom_remove_comments() {
if ( in_category( '1' ) ) {
remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.