How to correctly add jQuery to your WordPress Theme

August 12, 2016

If you want to extend some of the capacities of your Themes, you’ll need to add jQuery to it. Below is a quick snippet on how to do it properly.

if (!is_admin()) add_action("wp_enqueue_scripts", "jquery_enqueue", 11);
function jquery_enqueue() {
   wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://", false, null);

You can extend your reading on how to properly Enqueue Scripts in WordPress by following this documentation.