I want to add a simple highlight to my active menus in wordpress.
To do this I have this i have tracked down some pieces of code that might be useful (if they worked.) I am a complete rookie when it comes to js, but i know so much as to put this snippet of code inside my functions.php
// Enqueue JavaScripts
function theme_scripts() {
wp_enqueue_script('cartrawler', get_template_directory_uri() . 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', array(), '20120802', '1');
wp_enqueue_script('cartrawler', get_template_directory_uri() . '/js/jquery.colorbox-min.js', array(), '20120802', '1');
wp_enqueue_script('cartrawler', get_template_directory_uri() . '/js/activemenu.js', array(), '30120802', '1');
}
add_action('wp_enqueue_scripts', 'theme_scripts');
I have refered to this link in helping me out on the small script that makes this possible:
http://jsfiddle.net/K6F8m/
Your first
wp_enqueue_scriptline is bad. You’re using a fully qualified URL (https://ajax.googleapis.com...) but preceding it with your theme’s URL. Try replacing the firstwp_enqueue_scriptline with:If that doesn’t fix your problem outright, please elaborate on what the actual problem you’re having is. Are the scripts not showing up in the HTML? Are they in the HTML but not working?