wycks / WP-Skeleton-Theme

A responsive WordPress bare-bones theme based on the getskeleton framework
GNU General Public License v2.0
260 stars 59 forks source link

Enqueue Scripts #6

Closed slashequip closed 11 years ago

slashequip commented 11 years ago

Hey, good job so far with the theme just came across it and having a look through the code.

For WordPress best practice you should be enqueue'ing you scripts and style sheets through functions.php as opposed to manually including them in the head. This will allow plugins like W3 Total Cache to minify/compile the style sheets. This applies to scripts as well although slightly differently implementation see http://codex.wordpress.org/Function_Reference/wp_register_script

function load_all() {

    wp_register_style('skeleton-base', get_template_directory_uri().'/stylesheets/base.css', array(), '1.0', 'all');
    wp_enqueue_style('skeleton-base');

    wp_register_style('style', get_template_directory_uri().'/style.css', array(), '1.0', 'all');
    wp_enqueue_style('style');

    wp_register_style('skeleton-layout', get_template_directory_uri().'/stylesheets/layout.css', array(), '1.0', 'all');
    wp_enqueue_style('skeleton-layout');

}
add_action('wp_enqueue_scripts', 'load_all');

Hope that helps a bit and again good job so far :)

wycks commented 11 years ago

Your wish is my command:) fixed.