Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A simple example of Adding CSS to WordPress Theme Via functions.php File
// Load the theme stylesheets
function theme_styles()
// Example of loading a jQuery slideshow plugin just on the homepage
wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' );
// Load all of the styles that need to appear on all pages
wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'custom', get_template_directory_uri() . '/css/custom.css' );
// Conditionally load the FlexSlider CSS on the homepage
if(is_page('home')) {
add_action('wp_enqueue_scripts', 'theme_styles');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment