Last active
September 7, 2015 09:27
-
-
Save nathanrice/af5c6b229ddbd93335ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag | |
add_filter( 'stylesheet_uri', 'custom_replace_default_style_sheet', 10, 2 ); | |
/** | |
* Replace main theme style sheet with custom one if viewing post in a particular category. | |
* | |
* Note: Replace X with the category ID you want to target. | |
*/ | |
function custom_replace_default_style_sheet( $stylesheet, $stylesheet_dir ) { | |
if ( is_singular( 'post' ) && in_category( X ) ) { | |
$stylesheet = $stylesheet_dir . '/custom.css'; | |
} | |
return $stylesheet; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment