Adding js file via plugin using wp_head action (doesn't work)
-
I tried a bunch of examples and nothing seems to work. I simply want to load a js in my blog. (but not in admin pages)
This is the code I added to the bottom of my plugin php file
function load_js_file() { wp_enqueue_script('jquery'); wp_enqueue_script('the_js', WP_PLUGIN_URL.'/my_plugin/my_javascript.js'); echo "test"; } add_action('wp_head', 'load_js_file');
It echoes the “test” but no script is loaded. I’m not sure what I’m doing wrong.. Everything else works.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Adding js file via plugin using wp_head action (doesn't work)’ is closed to new replies.