Answers for "wp_localize_script"

PHP
0

wp_localize_script

<?php
function pw_load_scripts() {
 
	wp_enqueue_script('pw-script', plugin_dir_url( __FILE__ ) . 'js/pw-script.js');
	wp_localize_script('pw-script', 'pw_script_vars', array(
			'alert' => __('Hey! You have clicked the button!', 'pippin')
		)
	);
 
}
add_action('wp_enqueue_scripts', 'pw_load_scripts');
Posted by: Guest on March-26-2020

Code answers related to "wp_localize_script"

Browse Popular Code Answers by Language