Skip to content

Instantly share code, notes, and snippets.

@jvanja
Forked from martynchamberlin/functions.php
Created March 13, 2017 08:54
Show Gist options
  • Save jvanja/678e130aed371a017de01704c8c7065c to your computer and use it in GitHub Desktop.
Save jvanja/678e130aed371a017de01704c8c7065c to your computer and use it in GitHub Desktop.
How to get_the_content() with formatting
<?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