Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have an iframe tracking script of sorts that I need to add right after the body tag. After looking around on the web, I found that the body tag is in header.php and I should add a function to functions.php and then add the html to header.php. Not sure if this is right but...

I went to functions.php and added this:

function after_body(){
    do_action('after_body');
}

Then I went back to header.php, looked up to where the body tag was and added this:

<body><?php after_body(); ?>

But where exactly do I add my html/iframe code?

share|improve this question

1 Answer 1

You can directly write iframe after body tag in header.php
IF you want add function overthere then write this code in function.php file.

function after_body(){
  echo '<iframe src=""></iframe>'; 
} 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.