Skip to content

Instantly share code, notes, and snippets.

@kadai
Created November 6, 2017 06:18
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 kadai/0ef4efc69bbd8e4fa8d60d4593fa06f9 to your computer and use it in GitHub Desktop.
Save kadai/0ef4efc69bbd8e4fa8d60d4593fa06f9 to your computer and use it in GitHub Desktop.
<?php
add_action( 'wp_footer', 'funcion_codigo_especial' );
function funcion_codigo_especial(){
/* AQUÍ IMPRIMIMOS EL CÓDIGO JAVASCRIPT A USAR */
/* O LO PODEMOS DELIMITAR ENTRE "?>" Y <?php" */
}
?>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
(function(){
var ique=document.createElement("script"),iqueC=document.getElementsByTagName("script")[0];
ique.async=true;
ique.src='http://chat.dominio.net/cgi-bin/Empresa/js.js';
ique.charset='UTF-8';
ique.setAttribute('crossorigin','*');
iqueC.parentNode.insertBefore(ique,iqueC);
})();
</script>
<?php
add_action( 'wp_enqueue_scripts', 'el_script_agregado' );
function el_script_agregado(){
/* AGREGAMOS NUESTRO SCRIPT AL FINAL DEL DOCUMENTO WEB */
/* EL ÚLTIMO PARAMETRO INDICA QUE AHÍ SE DEBE AGREGAR (EN PIE DE PÁGINA [CIERTO|FALSO]) */
wp_enqueue_script('mi_script', get_template_directory_uri() . '/url-al-script/en-tema/archivo.js', array('jquery'), '1.0.0', TRUE);
}
?>
<script type="text/javascript">
(function($){
/* CÓDIGO EN jQuery QUE USA LAS "$" */
})( jQuery );
</script>
<script type="text/javascript">
jQuery(document).ready(function( $ ) {
/* CÓDIGO EN jQuery QUE USA LAS "$" */
/* Y QUE VA EN UN WIDGET */
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment