Skip to content

Instantly share code, notes, and snippets.

@thom4parisot
Created January 10, 2012 16:08
Show Gist options
  • Save thom4parisot/1589781 to your computer and use it in GitHub Desktop.
Save thom4parisot/1589781 to your computer and use it in GitHub Desktop.
WordPress Stylesheet inclusion best practice
<?php
if (!is_admin()){
add_action('init', 'theme_init_stylesheets');
}
/**
* Registers stylesheets for the current (child) theme
*
* @wordpress:action init
*/
function theme_init_stylesheets(){
wp_enqueue_style('main', get_stylesheet_directory_uri().'style.css', array(), '1.0', 'screen,projection');
/*
If you have WP-LESS installed, use the same process with *.less files:
wp_enqueue_style('main', get_stylesheet_directory_uri().'style.less', array(), '1.0', 'screen,projection');
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment