Skip to content

Instantly share code, notes, and snippets.

@cdils
Last active December 11, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cdils/4533761 to your computer and use it in GitHub Desktop.
Save cdils/4533761 to your computer and use it in GitHub Desktop.
Conditionally show comments on a post based on the post author. Code specific to Genesis Framework. Regferehttp://codex.wordpress.org/Function_Reference/get_the_author
// Remove comments from posts
remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
// Add comments back in if conditions are met
add_action( 'genesis_after_post', 'cd_conditional_comments' );
function cd_conditional_comments() {
// Conditional Reference http://codex.wordpress.org/Function_Reference/get_the_author
if ('Author Display Name' == get_the_author() ) {
genesis_get_comments_template();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment