synackSA
Member
Posted 1 month ago #
Hi there
Is it possible to add custom code to all blogs accross MU, no matter what theme they are using? I need to add tracking code to all blogs on a MU system, this is custom tracking code and usually, I've just gone an added one include line in the footer.php, but it's always been on a single user system.
Is this possible?
Syn
If you know they have a footer then you can use the code snippet I posted the other day.
OR you can push it into the header by dropping a file into mu-plugins which contains something like:
<?php
function wpmu_header($blah){;
echo '<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAzDaUChkNH3lPjAjJapKq6RTvY22eKy7N0CiFH2Ct6wY8stwoVxR4QHlGjqnhLQYhV02RACCBlloxaA" type="text/javascript"></script>';
echo '<meta name="verify-v1" content="gh8YjrQxNNQP2cet22ZdfXucI+py1YHC/6eczI1ljHc=" >';
return $blah;
}
add_action('wp_head', 'wpmu_header');
?>
Yep, what Steve said. Hook into wp_head or wp_footer.
synackSA
Member
Posted 1 month ago #
Okay, if it's in mu-plugins, will it be a compulsary plugin for all the blogs, or could the blogs technically disable it?
code in mu-plugins is run automatically, so it can't be deactivated, unless you wrote the code to allow it to be turned off
synackSA
Member
Posted 1 month ago #
If it doesn't show up on some blogs, check the footer.php in that theme to see if it calls wp_footer();
Which is why I suggested the alternative of putting it in the header ;-)