wp_get_theme()获取主题信息

目录

描述

Gets a WP_Theme object for a theme.

wp_get_theme() 描述

用法

<?php $theme wp_get_theme$stylesheet$theme_root ); ?>

wp_get_theme() 用法

参数

$stylesheet

(string) (可选) Directory name for the theme. Defaults to current theme.

默认值: Null

$theme_root

(string) (可选) Absolute path of the theme root to look in. If not specified, the value returned by get_raw_theme_root() will be used.

默认值: Null

wp_get_theme() 参数

返回值

This function returns an instance of the WP_Theme object, which includes the following properties:

Name 

Theme name as given in theme's style.css

ThemeURI 

The URI of the theme's webpage

Description 

The description of the theme

Author 

The theme's author

AuthorURI 

The website of the theme author

Version 

The version of the theme

Template 

(Optional — used in a child theme) The folder name of the parent theme

Status 

If the theme is published

Tags 

Tags used to describe the theme

TextDomain 

The text domain used in the theme for translation purposes

DomainPath 

Path to the theme translation files

wp_get_theme() 返回值

示例

Echo the name of the current active theme.

Echo the name of an installed theme.

Display the Current Theme's Version

Display the Current Theme Author URI

Get Other Data: Text Domain & Theme URI

wp_get_theme() 示例

历史

添加于 版本: 3.4.0

wp_get_theme() 历史