Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action('wp_enqueue_scripts', 'my_scripts');
- function my_scripts() {
- // Add your JS file
- wp_enqueue_script( 'my_script', get_template_directory_uri().'/js/functions.js' );
- // Localize your script with server side data
- global $sitepress;
- wp_localize_script( 'my_script', 'my_var', array(
- 'wpml_current_language' => $sitepress->get_current_language(),
- 'any_other_var' => 'any_other_value',
- ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement