我正在开发一个插件,用于返回WP\\u主题对象属性的实例。该插件本质上允许创建简单的子主题。
/*
Theme Name: <?php echo $new_theme_title, \'\\n\'; ?>
Description: <?php echo $new_theme_description, \'\\n\'; ?>
Author: <?php echo $new_theme_author, \'\\n\'; ?>
Template: <?php echo $parent_theme_template, \'\\n\'; ?>
Author URI: <?php echo \'http://buildtheweb.design\', \'\\n\'; ?>
Version: <?php $my_theme = wp_get_theme();echo $my_theme->get( \'Name\' ) . " is version " . $my_theme->get( \'Version\' ), \'\\n\';?>
License: See <?php echo $parent_theme_template . \'(Google Search)\', \'\\n\'; ?>
License URI: See <?php echo $parent_theme_template . \'(Google Search)\', \'\\n\'; ?>
Tags: <?php $my_theme = wp_get_theme(); echo $my_theme->get( \'Tags\' ); ?>
Text Domain: <?php echo $parent_theme_template. \'-child\' , \'\\n\'; ?>
*/
创建并返回除标记以外的所有我们想要的内容。我不知道如何让数组显示父主题标记。
/*
Theme Name: New Child Theme
Description: Testing our awesome child theme creation plugin
Author: Jarod Thornton
Template: twentysixteen
Author URI: http://buildtheweb.design
Version: Twenty Sixteen is version 1.1
License: http://domain.com/wp-content/themes/twentysixteen/style.css
License URI: ^
Tags: Array
Text Domain: twentysixteen-child
*/
我很欣赏你的见解。
最合适的回答,由SO网友:Bruno Cantuaria 整理而成
它正在输出单词Array
这是不言而喻的。您需要将数组转换为字符串,而不是直接回显它。尝试implode
, 类似于:
Tags: <?php $my_theme = wp_get_theme(); echo implode(\', \', $my_theme->get( \'Tags\' ) ); ?>