1

I've got a plugin I am working on to return an instance of the WP_Theme object properties. The plugin essentially allows for a simple child-theme creation.

/*
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'; ?>
*/

Creates and returns everything we want except the tags. I don't know how to get the array to show the parent theme tags.

/*
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
*/

I appreciate any insight.

  • echo implode(", ", $my_theme->get( 'Tags' )); ? – Samuel Elh May 23 '16 at 13:45
  • Ah, TY. If you post this as an informed answer I will accept. Otherwise Bruno Cantuaria will get it. JS – Jarmerson May 23 '16 at 13:55
  • Wait!. haha. I am just kidding. Let Bruno score some points ;) Thanks. – Samuel Elh May 23 '16 at 13:57
1

It's outputting the word Array which is self explanatory. Instead of direct echoing it, you will need to turn the array into a string. Try implode, something like:

Tags:           <?php $my_theme = wp_get_theme(); echo implode(', ', $my_theme->get( 'Tags' ) ); ?>
  • Thank you. I was able to use echo implode(", ", $my_theme->get( 'Tags' ));, but your answer got me there. – Jarmerson May 23 '16 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.