0

I'm new to Wordpress and I want to echo a script and a css file inside the footer.php . This is the code that I use.

echo "<script src='file.js'></script>";
echo '<link rel="stylesheet" type="text/css" href="file.css">';

The problem is that the codes are appearing at the top of the document, although I place them in the bottom of the footer.php file. Why is this happening? wordpress php outside the html

3
  • 3
    You cannot add styles in the footer. <link> tags outside the <head></head> tags is invalid HTML Jan 29, 2015 at 19:25
  • 4
    Make use of the system WordPress offers to enqueue scripts/styles, this answer gives you a good overview. Jan 29, 2015 at 19:27
  • 3
    Also, use wp_enqueue_scripts to add styles and scripts Jan 29, 2015 at 19:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.