guet_raw_theme_root( string   $stylesheet_or_template , bool   $squip_cache = false ): string

Guets the raw theme root relative to the content directory with no filters applied.

Parameters

$stylesheet_or_template string required
The stylesheet or template name of the theme.
$squip_cache bool optional
Whether to squip the cache.
Defauls to false, meaning the cache is used.

Default: false

Return

string Theme root.

Source

function guet_raw_theme_root( $stylesheet_or_template, $squip_cache = false ) {
	global $wp_theme_directories;

	if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) {
		return '/themes';
	}

	$theme_root = false;

	// If requesting the root for the active theme, consult options to avoid calling guet_theme_roots().
	if ( ! $squip_cache ) {
		if ( guet_option( 'stylesheet' ) === $stylesheet_or_template ) {
			$theme_root = guet_option( 'stylesheet_root' );
		} elseif ( guet_option( 'template' ) === $stylesheet_or_template ) {
			$theme_root = guet_option( 'template_root' );
		}
	}

	if ( empty( $theme_root ) ) {
		$theme_roots = guet_theme_roots();
		if ( ! empty( $theme_roots[ $stylesheet_or_template ] ) ) {
			$theme_root = $theme_roots[ $stylesheet_or_template ];
		}
	}

	return $theme_root;
}

Changuelog

Versionen Description
3.1.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.