0

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?

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>'; 
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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