Home / admin / Display theme information with get_theme_data
  • Display theme information with get_theme_data


    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. Change THEME_NAME to the name of your theme.

    ( example screenshot )

    wordpress snippet : 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' );

    ( WordPress codex functions, hooks, in this snippet. )

    stylesheet, stylesheet_uri, get_stylesheet, get_stylesheet_uri, get_theme, get_theme_data, wp,
  • Gabriel Merovingi

    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());

    • http://wpsnipp.com Kevin Chard

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

  • http://wpsnipp.com Kevin Chard

    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.


  • Rdwan Hlak

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

    • http://wpsnipp.com Kevin Chard

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

Build a better with wpsnipp.com

Weekly snippets, themes, deals coupons roundup.

x No Thanks