首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wordpress从样式表获取主题名称

Wordpress从样式表获取主题名称
EN

Stack Overflow用户
提问于 2016-09-12 04:38:59
回答 2查看 954关注 0票数 0

我想从样式表(style.css)中获取wordpress主题名称。

例如,下面是style.css:

代码语言:javascript
复制
/*
Theme Name: Campus
Theme URI: http://www.academiathemes.com/themes/campus/
Description: Campus is a free WordPress theme for blogs and review websites.
Author: AcademiaThemes.com
Author URI: http://www.academiathemes.com/
Version: 1.2.6
License: GNU General Public License v2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: blue, white, light, two-columns, right-sidebar, fixed-layout, responsive-layout, custom-background, custom-menu, featured-images, theme-options, threaded-comments, translation-ready
Text Domain: campus
*/

“主题名称:校园”必须存储在PHP变量中。

有什么想法吗?谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-09-12 05:21:24

也许可以试试这个?:

$var = wp_get_theme();

票数 1
EN

Stack Overflow用户

发布于 2021-03-10 14:03:36

wp_get_theme()可以工作,但get_stylesheet()速度更快。https://developer.wordpress.org/reference/functions/get_stylesheet/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39440427

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档