Last active
February 16, 2018 00:09
-
-
Save martynchamberlin/6227241 to your computer and use it in GitHub Desktop.
How to get_the_content() with formatting
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
<?php | |
/** | |
* Instead of calling get_the_content(), call this function instead, and it'll all be good | |
*/ | |
function get_the_content_with_formatting() | |
{ | |
ob_start(); | |
the_content(); | |
$the_content = ob_get_contents(); | |
ob_end_clean(); | |
return $the_content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment