X

Display theme information with wp_get_theme

Adding this snippet to your WordPress theme will let you display data from your theme file: name, title, URI, description, authorURI, template, version, status, tags, author. We have updated this snippet to coincide with the most recent changes to WordPress.


( example screenshot )

<?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' );

?>

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

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!