Last active
November 9, 2016 12:16
-
-
Save AntonioRigo/8dae44eb7ef063b5133d to your computer and use it in GitHub Desktop.
Añadir scripts a un child theme para WordPress
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 | |
function enqueue_custom_scripts(){ // función para agregar scripts. | |
if ( !is_admin() ) { // instrucción para solo cargar el script si NO es el área de administración. | |
// registra la ubicación de tu script, sus dependencias, versión, y si quieres añadirlo al final del archivo. | |
wp_register_script( 'custom_script', get_bloginfo('stylesheet_directory') . '/js/custom_script.js', array( 'jquery' ), '1.0', true ); | |
// agrega el script a la cola de carga. | |
wp_enqueue_script( 'custom_script' ); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'enqueue_custom_scripts' ); // hook que dispara la función para agregar scripts. | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment