Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save richtabor/2a1b1175234a30dc7ce75e0a71e536c6 to your computer and use it in GitHub Desktop.
Save richtabor/2a1b1175234a30dc7ce75e0a71e536c6 to your computer and use it in GitHub Desktop.
if(!function_exists('get_theme_file_uri')){
function get_theme_file_uri( $file = '' ) {
$file = ltrim( $file, '/' );
if ( empty( $file ) ) {
$url = get_stylesheet_directory_uri();
} elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
$url = get_stylesheet_directory_uri() . '/' . $file;
} else {
$url = get_template_directory_uri() . '/' . $file;
}
return apply_filters( 'theme_file_uri', $url, $file );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment