Skip to content

Instantly share code, notes, and snippets.

@zedejose
Last active August 29, 2015 14:00
Show Gist options
  • Save zedejose/4edda33e9819fc4fcd3d to your computer and use it in GitHub Desktop.
Save zedejose/4edda33e9819fc4fcd3d to your computer and use it in GitHub Desktop.
Get Entire Post Or Page In A PHP Variable
<?php
// From http://www.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks/
function callback($buffer) {
// modify buffer here, and then return the updated code
return $buffer;
}
function buffer_start() {
ob_start("callback");
}
function buffer_end() {
ob_end_flush();
}
add_action('wp_head', 'buffer_start');
add_action('wp_footer', 'buffer_end');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment