我想从样式表(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变量中。
有什么想法吗?谢谢。
发布于 2016-09-12 05:21:24
也许可以试试这个?:
$var = wp_get_theme();
发布于 2021-03-10 14:03:36
wp_get_theme()可以工作,但get_stylesheet()速度更快。https://developer.wordpress.org/reference/functions/get_stylesheet/
https://stackoverflow.com/questions/39440427
复制相似问题