我想从stylesheet(style.css)中获取wordpress主题名称。
例如,style.css:
/*
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变量中。
有什么想法吗?谢谢。
答案 0 :(得分:1)
也许试试这个?:
$ var = wp_get_theme();
答案 1 :(得分:0)
wp_get_theme() 有效,但 get_stylesheet() 更快。 https://developer.wordpress.org/reference/functions/get_stylesheet/