get_theme_root()获取主题themes文件夹的绝对目录路径

目录

描述

译文

检索主题 目录的路径。

没有结尾斜线。

原文

Retrieves the absolute path to the themes directory, without the trailing slash.

get_theme_root() 描述

用法

<?php get_theme_root(); ?>

get_theme_root() 用法

参数

$stylesheet_or_template

(string) (必填) The stylesheet or template name of the theme.

默认值: None

get_theme_root() 参数

返回值

(string

Absolute path to the themes directory (without the trailing slash).

get_theme_root() 返回值

示例

Number of Subdirectories in Themes Directory

The function below informs about the number of subdirectories in the themes directory. Note that this doesn't necessarily match the number of themes recognized by WordPress.

Example output:

There are 5 subdirectories in the /home/user/public_html/wp-content/themes directory.

get_theme_root() 示例

注意

get_theme_root() 注意

历史

添加于 版本: 1.5.0

get_theme_root() 历史

源文件

get_theme_root() 函数的代码位于 wp-includes/theme.php.

get_theme_root() 源文件

相关