Created
May 10, 2016 15:07
-
-
Save eddt/398124c06ffa28410dcef1ac81125a0e to your computer and use it in GitHub Desktop.
inserts content after opening body tag
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
add_filter('template_include','yoursite_template_include',1); | |
function yoursite_template_include($template) { | |
ob_start(); | |
return $template; | |
} | |
add_filter('shutdown','yoursite_shutdown',0); | |
function yoursite_shutdown() { | |
$insert = "\n<!--YOUR INSERTED ". get_option('setting_a') ." HTML GOES HERE-->"; | |
$content = ob_get_clean(); | |
$content = preg_replace('#<body([^>]*)>#i',"<body$1>{$insert}",$content); | |
echo $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment