[wp-trac] [WordPress Trac] #12563: New action on body open
WordPress Trac
wp-trac at lists.automattic.com
Sat Mar 5 03:12:31 UTC 2011
#12563: New action on body open
-----------------------------------------+-----------------------------
Reporter: joostdevalk | Owner: joostdevalk
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Themes | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion close |
-----------------------------------------+-----------------------------
Changes (by mikeschinkel):
* cc: mikeschinkel@… (removed)
Comment:
I agree with @nacin and @jorbin. This can't be added to core but must be
added to each and every theme, which is a non-starter.
But there is a workaround, if you need it ''(though it really is a
hack):''
{{{
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 = "[YOUR INSERTED HTML GOES HERE]";
$content = ob_get_clean();
$content =
preg_replace('#<body([^>]*)>#i',"<body$1>{$insert}",$content);
echo $content;
}
}}}
Hope this helps.
-Mike
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12563#comment:16>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list