Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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