get_template()
get_template()
检索当前主题的名称。
Retrieve name of the current theme.
返回(Return)
(string)模板名称。
源码(Source)
/** * Retrieve name of the current theme. * * @since 1.5.0 * * @return string Template name. */ function get_template() { /** * Filter the name of the current theme. * * @since 1.5.0 * * @param string $template Current theme's directory name. */ return apply_filters( 'template', get_option( 'template' ) ); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
1.5.0 | wp-includes/theme.php:304 | 5 | 3 |
笔记(Notes)
例子
请注意,如果当前激活了子主题,get_模板将返回父主题的名称,而不是子主题的名称。
get_template() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_template/