wp localize script

Solutions on MaxInterview for wp localize script by the best coders in the world

showing results for - "wp localize script"
Fatima
07 Nov 2016
1<?php
2function pw_load_scripts() {
3 
4	wp_enqueue_script('pw-script', plugin_dir_url( __FILE__ ) . 'js/pw-script.js');
5	wp_localize_script('pw-script', 'pw_script_vars', array(
6			'alert' => __('Hey! You have clicked the button!', 'pippin')
7		)
8	);
9 
10}
11add_action('wp_enqueue_scripts', 'pw_load_scripts');