Skip to content

Instantly share code, notes, and snippets.

@rodrigobertin
Created October 5, 2017 04:40
Show Gist options
  • Save rodrigobertin/a7c309704cf6c19cdb938d96d2cefb49 to your computer and use it in GitHub Desktop.
Save rodrigobertin/a7c309704cf6c19cdb938d96d2cefb49 to your computer and use it in GitHub Desktop.
Cargar JS y CSS Wordpress
<?php
// Load the theme stylesheets
function theme_styles() {
// Example of loading a jQuery slideshow plugin just on the homepage
wp_register_style(
'bootstrap-styles', // handle name
get_template_directory_uri() . '/css/styles.min.css', // the URL of the stylesheet
array(), // an array of dependent styles
'1.2', // version number
'screen' // CSS media type
);
wp_register_style(
'main-styles', // handle name
get_template_directory_uri() . '/css/main.css', // the URL of the stylesheet
array(), // an array of dependent styles
'1.2', // version number
'screen' // CSS media type
);
wp_enqueue_style( 'bootstrap-styles' );
wp_enqueue_style( 'main-styles' );
}
function theme_js() {
wp_register_script('production',get_template_directory_uri() . '/js/production.js',array( 'jquery' ),'1',true );
wp_register_script('main',get_template_directory_uri() . '/js/main.min.js',array( 'jquery' ),'1',true );
wp_enqueue_script('miscript');
wp_enqueue_script('main');
}
add_action( 'wp_head','theme_styles' );
add_action( 'wp_head','theme_js' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment