Skip to content

Instantly share code, notes, and snippets.

@ChrisCree
Created July 15, 2014 21:57
Show Gist options
  • Save ChrisCree/e9535476bfb7b0779147 to your computer and use it in GitHub Desktop.
Save ChrisCree/e9535476bfb7b0779147 to your computer and use it in GitHub Desktop.
Remove comments from specific category posts in the Genesis theme framework.
<?php
// Do not copy opening PHP tag above
// Remove comments from specific categories. Change out categories in array as needed.
add_action( 'wp_enqueue_scripts', 'wsm_remove_comments_in_category' );
function wsm_remove_comments_in_category() {
if ( in_category( array( 'No Comments', 'Uncategorized', ) ) ) {
remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
remove_action( 'genesis_after_entry', 'genesis_get_comments_template' );
remove_action( 'genesis_comment_form', 'genesis_do_comment_form' );
remove_action( 'genesis_comments', 'genesis_do_comments' );
remove_action( 'genesis_list_comments', 'genesis_default_list_comments' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment