Despite its popularity on the web, I am not fan of WordPress.  It has a very procedural codebase, and modifying any of it seems rather hacky. If you want a site that will be anything other than a blog, then don’t use it. Try a nice MVC framework like Larvel or Yii.

Saying that, it has a large developer community, and its admin interface is very nicely designed from a UX perspective, which bloggers love. I admit I use it for my blog, because its so easy to set up and use.

One “WordPress’ism” I have noticed is that it loads jQuery by default, and it loads it in the <head> element. I am not sure why it does this, I cannot find an explanation for it anywhere online. To improve page load speeds its obviously better to load any javascript file before the end body tag.

This is the hacky solution I have come up with to load jQuery just before the </body> tag. (Assuming your theme file calls wp_foot(); just before </body>)

  1. Create a function that deregisters WordPress from loading the jQuery.
  2. Then tell WordPress to load it again.
  3. Bind the new function to the wp_enqueue_scripts hook.
function your_themes_scripts(){

   // Hack to stop wordpress from loading jQuery in the head of the page
   wp_deregister_script( 'jquery' );

   // Then load it in the footer.
   wp_enqueue_script( 'jquery', 'path-to-jquery.js' );
}

add_action( 'wp_enqueue_scripts', 'your_themes_scripts' );

I know it’s not a nice piece of code by any stretch of the imagination, but I am sure you’ve seen much worse on WordPress!