X

How to Display Theme Information with wp_get_theme

Snippets by IsItWP

Are you looking for a way to display data from your WordPress theme file like name, title, URI, etc? While there’s probably a plugin for this, we have created a quick code snippet that you can use to display theme information with wp_get_theme.

Instructions:

All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

<?php

$theme_data = wp_get_theme();
echo $theme_data->get( 'Name' );        // Theme name as given in style.css
echo $theme_data->get( 'ThemeURI' );
echo $theme_data->get( 'Description' );
echo $theme_data->get( 'Author' );
echo $theme_data->get( 'AuthorURI' );
echo $theme_data->get( 'Version' );
echo $theme_data->get( 'Template' );
echo $theme_data->get( 'Status' );
echo $theme_data->get( 'Tags' );
echo $theme_data->get( 'TextDomain' );
echo $theme_data->get( 'DomainPath' );

?>

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 9 best WordPress real estate plugins and how to secure your WordPress forms with password protection.

Comments   Leave a Reply

  1. This function has been deprecated. That means it has been replaced by a new function or is no longer supported

    1. Thanks for the heads up, I updated the snippet, Cheers.

  2. Hi Cliff, technically you could however that would not be a good way of doing things. I would suggest using something like jquery to let people change stylesheets. This tutorial should help you get started with that.

    http://www.cssnewbie.com/simple-jquery-stylesheet-switcher/

  3. Gabriel Merovingi July 16, 2011 at 2:02 am

    I love this feature!
    You can also call the css file by using get_stylesheet_uri() that way you don’t have to set the theme name:

    $theme_data = get_theme_data(get_stylesheet_uri());

    1. Ahh good call Gabriel ill have to update the post to include this method.

Add a Comment Cancel reply

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!