my wp_enqueue_script does not seem to work, i can't understand why :
i have a child theme of twenty ten,
i wrote this in my functions.php file (in my theme) :
<?php
function my_scripts_method() {
wp_enqueue_script(
'patScript',
get_stylesheet_directory_uri() . '/js/patScript.js',
array('jquery')
);
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
?>
then in my header :
<script type="text/javascript" src="<?php get_stylesheet_directory_uri().'/js/patScript.js'; ?>"></script>
and the file is :
$(function () {
alert("hello");
});
But alert does not work. The path is correct, when i echo get_stylesheet... it gives me the right path where my file is located. Would you have any idea?
Thanks a lot
EDIT : the console in Firefox tells me that :
$(function () {
"is not a function" : does it mean it does not recognize jquery? i added :
wp_enqueue_script("jquery");
above my previous enqueue script, but same thing...