Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- ::_di_frontend.php::
- // How to replace template variables with PHP variables
- function get_replacement_vars(){
- return array(
- '{post_id}' => get_the_ID(),
- '{post_title}' => get_the_title()
- );
- }
- $replacements = get_replacement_vars();
- $output = str_replace(array_keys($replacements),array_values($replacements), $output);
- */
- function buffer_callback($buffer){
- // manipulate HTML (replace template tags,
- return str_replace("{name}", "Chris", $buffer);
- }
- function ob_init(){
- ob_start('buffer_callback');
- }
- add_action('template_redirect', 'ob_init', 0);
- function ob_shutdown(){
- ob_end_flush();
- }
- add_action('shutdown', 'ob_shutdown', 1000);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement