Skip to content

Instantly share code, notes, and snippets.

@rintoug
Created June 6, 2017 09:56
Show Gist options
  • Save rintoug/8f7b72e442cc3b3297ee285a6970623e to your computer and use it in GitHub Desktop.
Save rintoug/8f7b72e442cc3b3297ee285a6970623e to your computer and use it in GitHub Desktop.
Adding CSS to WordPress Theme Via functions.php File
<?php
// Load the theme stylesheets
function active_theme_styles()
{
// Load all of the styles that need to appear on all pages
wp_enqueue_style( 'custom', get_stylesheet_directory_uri() . '/css/custom.css' );
// Conditionally load some thing in the home page
wp_register_style( 'slideshow', get_stylesheet_directory_uri() . '/css/slideshow.css' );
if(is_page('home')) {
wp_enqueue_style('slideshow');
}
}
add_action('wp_enqueue_scripts', 'active_theme_styles');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment