Skip to content

Instantly share code, notes, and snippets.

@ChrisCree
Last active April 18, 2020 20:51
Show Gist options
  • Save ChrisCree/6389134 to your computer and use it in GitHub Desktop.
Save ChrisCree/6389134 to your computer and use it in GitHub Desktop.
Adding a custom.css stylesheet to your Genesis child theme (will work for non Genesis themes as well). First create a custom.css file with your custom styles and FTP it up to your child theme directory. Then add the below code to your child theme's functions.php file.
<?php
// Do not copy opening php tag above
add_action( 'wp_enqueue_scripts', 'wsm_custom_stylesheet', 20 );
function wsm_custom_stylesheet() {
wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/custom.css' );
}
@DigitalEssence
Copy link

Very useful, thank you. Adding this to my essential functions.

@tcolling
Copy link

Hi Chris -

Is it possible to do something similar to this for customizations of the php files' code by enqueing some sort of a "custom.php" file for php customizations?

@RBNZ
Copy link

RBNZ commented Apr 18, 2020

Three questions:
1 - This file will be deleted when I update my theme?
2 - Will that function deleted once I update the theme?
3 - If yes, is not more easy to just edit the Child Theme style.cc and upload it after each time I upload the theme?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment