Created
April 20, 2019 04:29
-
-
Save yeriepiscesa/fc87da06142c6e7657c4612605055cdf to your computer and use it in GitHub Desktop.
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 | |
$page_slug = 'cf7-administrative-data'; | |
function wpcf7_enqueue_script() { | |
if( is_page( $page_slug ) ) { | |
wp_register_script( 'yp-administrative', plugin_dir_url( __FILE__ ) . 'chainedselect.js' ); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'wpcf7_enqueue_script' ); | |
function wpcf7_load_javascript() { | |
if( is_page( $page_slug ) ) { | |
wp_localize_script( 'yp-administrative', 'chainedselect', array( | |
'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
'security' => wp_create_nonce( 'ajax-get-administrative' ), | |
)); | |
wp_enqueue_script( 'yp-administrative' ); | |
} | |
} | |
add_action( 'wp_head', 'wpcf7_load_javascript', 999, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment