Skip to content

Instantly share code, notes, and snippets.

@scribu
Created October 14, 2010 15:19
Show Gist options
  • Select an option

  • Save scribu/626355 to your computer and use it in GitHub Desktop.

Select an option

Save scribu/626355 to your computer and use it in GitHub Desktop.
locate_skin_url()
<?php
function locate_skin_url( $name ) {
$dir = false === strpos($name, '.css') ? 'js' : 'css';
if ( file_exists(STYLESHEETPATH . "/$dir/$name")) {
$url = get_bloginfo('stylesheet_directory') . "/$dir/$name";
} elseif ( file_exists(TEMPLATEPATH . "/$dir/$name") ) {
$url = get_bloginfo('template_directory') . "/$dir/$name";
} else {
$url = '';
}
return $url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment