<?php wp_head(); ?> needs to be right before </head>?

According to the WordPress codex, the wp_head(); should be located right before the closing head tag.

When I insert the code after the wp_head(); it works. But when I insert it before wp_head(); as it should be, it results in a blank space. Look at the picture to see what Firebug sais when it goes blank.

Read More

This is the code:

<link rel="stylesheet" href="flexslider/flexslider.css" type="text/css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script src="flexslider/jquery.flexslider.js"></script>

<script type="text/javascript" charset="utf-8">   $(window).load(function() {
    $('.flexslider').flexslider({

         slideshow: true,
         controlNav: false,
         directionNav: false,   animation: "slide",     slideshowSpeed: 4500,   animationDuration: 600,   

             });   }); </script>

Firebug: enter image description here

How come is that? Any ideas?

Related posts

Leave a Reply

1 comment

  1. Yes, wp_head() should be before </head>, but your javascript code should be before </body>.

    Javascript is always recommended to be put in the end of the DOM. In case that is not possible (e.g. specific javascript must be loaded before the DOM, which does not seem to be true in your case) , put it before </head> and after wp_head();

    EDIT

    Also, what I noticed in your case is that your main script might not be accessible if you are using SEO friendly urls. You should specify absolute url.