rodrigobertin
10/5/2017 - 4:40 AM

Cargar JS y CSS Wordpress

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' );