Created
November 20, 2019 16:42
-
-
Save DarioBF/6e4773a295a103ae2326a3388c326742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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