Created
October 20, 2016 12:46
-
-
Save lomboboo/d6877bbfe981484bc87f34c6d499c051 to your computer and use it in GitHub Desktop.
Wordpress functions.php adding scripts with passing variables
This file contains hidden or 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 custom_scripts() | |
{ | |
wp_deregister_script('jquery'); | |
wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js', array(), '1.0.0', false); | |
wp_enqueue_script('jquery-ui', '//code.jquery.com/ui/1.11.4/jquery-ui.js', array(), '1.0.0', true); | |
wp_enqueue_script('custom-script', get_template_directory_uri() . '/assets/js/script.js', array(), '1.0.0', true); | |
$map_pin_url = array( | |
'url' => get_template_directory_uri() . '/assets/img/map-pin.png', | |
); | |
wp_localize_script( 'custom-script', 'map_pin_url', $map_pin_url ); | |
} | |
add_filter('wp_enqueue_scripts', 'custom_scripts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment