get_theme_root() WP 1.5
Получает абсолютный путь папки (каталога) с темами WordPress. Слэш на конце отсутствует.
Пример пути: /home/site.ru/public_html/wp-content/themes
.
Основа для: get_template_directory()
Хуки из функции
Возвращает
Строку. Путь до директории шаблонов.
Использование
$path = get_theme_root( $stylesheet_or_template );
- $stylesheet_or_template(строка) (обязательный)
- Название шаблона темы или называние стилей темы.
По умолчанию: false
Примеры
#1 Получим полный путь до каталога тем:
$theme_root = get_theme_root(); echo $theme_root; // выведет: /home/k/foo/site.ru/www/wp-content/themes
#2 Количество подкаталогов в каталоге темы
function display_themes_subdirs_count_info() $theme_root = get_theme_root(); $files_array = glob("$theme_root/*", GLOB_ONLYDIR); echo count($files_array) . " подкаталогов в каталоге: " . $theme_root; }
Заметки
- Global. Массив. $wp_theme_directories
Список изменений
С версии 1.5.0 | Введена. |
Код get_theme_root() get theme root WP 5.6
Cвязанные функции
Из метки: theme path url (папка темы)
Еще из метки: path directory (путь папка)
Еще из раздела: Другие функции темы
- add_theme_support()
- bloginfo()
- body_class()
- current_theme_supports()
- get_custom_header_markup()
- get_custom_logo()
- get_header_image()
- get_header_image_tag()
- get_header_textcolor()
- get_header_video_url()
- get_page_template()
- get_page_templates()
- get_post_class()
- get_query_template()
- get_stylesheet()
- get_theme_mod()