Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* 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
You can’t perform that action at this time.