Last active
January 26, 2018 17:57
-
-
Save Edwardtonnn/e569750f9b09aca1ac521990e89b416b to your computer and use it in GitHub Desktop.
Adding jQuery to WordPress Avada Child Theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$(document).ready(function() { | |
$('.newHover').hover( | |
function(){ | |
jQuery( "a", this).toggleClass("white"); | |
}); | |
}) | |
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//this goes in functions.php near the top | |
add_action('wp_enqueue_scripts', 'my_scripts_method'); | |
function my_scripts_method() { | |
// register your script location, dependencies and version | |
wp_register_script('custom_script', | |
get_stylesheet_directory_uri() . '/js/newHover-script.js', | |
array('jquery'), | |
'1.0' ); | |
// enqueue the script | |
wp_enqueue_script('custom_script'); | |
} | |
function theme_enqueue_styles() { | |
wp_enqueue_style( 'avada-parent-stylesheet', get_template_directory_uri() . '/style.css' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); | |
function avada_lang_setup() { | |
$lang = get_stylesheet_directory() . '/languages'; | |
load_child_theme_textdomain( 'Avada', $lang ); | |
} | |
add_action( 'after_setup_theme', 'avada_lang_setup' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment