Skip to content

Instantly share code, notes, and snippets.

@DarioBF
Created November 20, 2019 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DarioBF/6e4773a295a103ae2326a3388c326742 to your computer and use it in GitHub Desktop.
Save DarioBF/6e4773a295a103ae2326a3388c326742 to your computer and use it in GitHub Desktop.
/**
* Adds comments just before content, nothing between them
*/
add_filter( 'the_content', 'bf_comments_content', 10);
function bf_comments_content( $content) {
if( is_single() && comments_open() ) {
ob_start();
comments_template();
$comments = ob_get_contents();
ob_end_clean();
return $content . $comments;
}
else {
return $content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment