WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.