Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
add_action( 'wp_enqueue_scripts', 'registra_script' );
function registra_script(){
$version = date("ymd-Gis");
// registra o javascript
wp_enqueue_script( 'dispara-form-ajax', get_template_directory_uri() .'/caminhoDoSeuScript/disparaForm.js', array( 'jquery' ), $version, true );
// declara que a url do arquivo faz parte do (wp-admin/admin-ajax.php)
wp_localize_script( 'dispara-form-ajax', 'funcaoRegistrada', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment