get_raw_theme_root( string $stylesheet_or_template, bool $skip_cache = false )
Get the raw theme root relative to the content directory with no filters applied.
描述
参数
- $stylesheet_or_template
-
(string)
(Required)
The stylesheet or template name of the theme - $skip_cache
-
(bool)
(Optional)
Whether to skip the cache. Defaults to false, meaning the cache is used.Default value: false
返回值
(string) Theme root
源代码
File: wp-includes/theme.php
function get_raw_theme_root( $stylesheet_or_template, $skip_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 ( ! $skip_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;
}
更新日志
Version | 描述 |
---|---|
3.1.0 | Introduced. |
相关函数
Uses
-
wp-includes/theme.php:
get_theme_roots() -
wp-includes/option.php:
get_option()
Used By
-
wp-includes/class-wp-customize-manager.php:
WP_Customize_Manager::get_template_root() -
wp-includes/class-wp-customize-manager.php:
WP_Customize_Manager::get_stylesheet_root() -
wp-includes/theme.php:
get_theme_root() -
wp-includes/theme.php:
get_theme_root_uri() -
wp-includes/theme.php:
switch_theme() -
wp-includes/theme.php:
wp_get_themes() -
wp-includes/theme.php:
wp_get_theme()
Show 2 more used by
Hide more used by
你可能对这些文章感兴趣:
- wordpress函数get_the_posts_navigation()用法示例
- wordpress函数get_the_title()用法示例
- wordpress函数get_the_terms()用法示例
- wordpress函数get_the_tags()用法示例
- wordpress函数get_the_taxonomies()用法示例
- wordpress函数get_the_permalink()用法示例
- wordpress函数get_the_password_form()用法示例
- wordpress函数get_the_posts_pagination()用法示例
- wordpress函数get_the_modified_date()用法示例
- wordpress函数get_the_modified_time()用法示例
- wordpress函数get_the_modified_author()用法示例
- wordpress函数get_the_guid()用法示例
- wordpress函数get_the_ID()用法示例
- wordpress函数get_the_excerpt()用法示例
如有疑问,请前往问答中心反馈!
反馈