Skip to content

Instantly share code, notes, and snippets.

@jandrodev
Created August 21, 2015 07:16
Show Gist options
  • Save jandrodev/3c040d0ffa0d723f6831 to your computer and use it in GitHub Desktop.
Save jandrodev/3c040d0ffa0d723f6831 to your computer and use it in GitHub Desktop.
Wordpress enqueue styles and scripts examples (with Angular JS)
function styles_and_scripts() {
wp_enqueue_style( 'estilos', get_bloginfo('template_directory').'/library/css/main.css' );
wp_enqueue_script( 'navigation', get_bloginfo('template_directory').'/library/js/main.js', array(), '1.0', true );
wp_enqueue_script( 'jQuery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', array(), '1.11.0', false );
// ENQUEUE ANGULAR JS
// Register AngularJS
wp_register_script('angular-core', get_stylesheet_directory_uri() . '/library/js/libs/angular.min.js', array(), '1.4.4', false );
// Register our app.js, which has a dependency on angular-core
wp_register_script('angular-app', get_bloginfo('template_directory').'/angular/app.js', array('angular-core'), null, false);
// Enqueue all scripts
wp_enqueue_script('angular-core');
wp_enqueue_script('angular-app');
}
add_action( 'wp_enqueue_scripts', 'styles_and_scripts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment