Home / functions.php / Get entire post in variable
  • How to Get entire post in variable

    no thumbnail sorry: Get entire post in variable

    Adding this PHP code to your functions.php file of your wordpress theme will place a entire page into a PHP variable.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <?
    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');
    ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    wp_footer, wp_head, add_action, _e, wp,