I have a function in my functions file where i output Google Analytics code.
function mytheme_trackingcode(){
$mytheme_option = mytheme_get_global_options();
$tracking_code = $mytheme_option['tracking_code_head'];
if($tracking_code){
echo '$tracking_code';
}
}
add_action('wp_head', 'mytheme_trackingcode');
The problem is that the output comes right after the tag. I'm not sure what the problem is? wp_head is placed last in head-section.
wp_head()
?wp_head()
, which must be called at the correct time by your theme...typically inheader.php
.