Created
May 30, 2015 13:39
-
-
Save strangerstudios/ddab9431d21372a8703c to your computer and use it in GitHub Desktop.
Look for a stylesheet in a WP child theme or theme before loading a default plugin stylesheet.
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
//figure out which css to load | |
if(file_exists(get_stylesheet_directory() . "/pluginname/frontend.css")) | |
$css_url = get_stylesheet_directory_uri() . "/pluginname/frontend.css"; | |
elseif(file_exists(get_template_directory() . "/pluginname/frontend.css")) | |
$css_url = get_template_directory_uri() . "/pluginname/frontend.css"; | |
else | |
$css_url = plugins_url('css/frontend.css',dirname(__FILE__) ); | |
//load it | |
wp_enqueue_style('pluginname-frontend', $css_url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment