Reputation: 237
I am trying to add a custom script via my functions.php file.
Here is the code. First I am loading jQuery and then the script
When I view my source code I can not see a link to the script.
By the way, let me know if you need to see more of my code I wasn't sure how much I should post.
// jQuery
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
wp_enqueue_script('jquery');
}
// show Hide
function add_my_script() {
wp_enqueue_script(
'show-hide',
get_template_directory_uri() . '/js/show-hide.js',
array('jquery')
);
}
Upvotes: 0
Views: 875
Reputation: 38112
You're missing:
add_action( 'wp_enqueue_scripts', 'add_my_script' );
to hook add_my_script()
function on to action.
Upvotes: 1