Skip to content

Instantly share code, notes, and snippets.

@thiagotmendes
Last active January 30, 2018 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagotmendes/9b3b7a7500ddf8fc1382c51315a0f985 to your computer and use it in GitHub Desktop.
Save thiagotmendes/9b3b7a7500ddf8fc1382c51315a0f985 to your computer and use it in GitHub Desktop.
<?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