Forked from strangerstudios/override_plugin_stylesheet.php
Last active
August 29, 2015 14:25
-
-
Save cdsalmons/dffd7f6b3cdb656d357b 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