get_raw_theme_root

Definition:
function get_raw_theme_root( $stylesheet_or_template, $no_cache = false ) {}

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

Parameters

  • string $stylesheet_or_template: The stylesheet or template name of the theme
  • $no_cache

Return values

returns:Theme root

Source code

function get_raw_theme_root( $stylesheet_or_template, $no_cache = false ) {

	global $wp_theme_directories;



	if ( count($wp_theme_directories) <= 1 )

		return '/themes';



	$theme_root = false;



	// If requesting the root for the current theme, consult options to avoid calling get_theme_roots()

	if ( !$no_cache ) {

		if ( get_option('stylesheet') == $stylesheet_or_template )

			$theme_root = get_option('stylesheet_root');

		elseif ( get_option('template') == $stylesheet_or_template )

			$theme_root = get_option('template_root');

	}



	if ( empty($theme_root) ) {

		$theme_roots = get_theme_roots();

		if ( !empty($theme_roots[$stylesheet_or_template]) )

			$theme_root = $theme_roots[$stylesheet_or_template];

	}



	return $theme_root;

}

9633

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: