Displaying Theme Information in WordPress

Here’s a awesome trick which allows you to display theme information from your theme’s stylesheet i.e. style.css file. To extract the theme information we are going to use wp_get_theme() function. It returns an instance of WP_Theme object.

Quick Tip : Display Custom Taxonomies in WordPress Tag Cloud Widget

<?php
$theme_data = wp_get_theme();
echo $theme_data->get( 'Name' );        // Theme name
echo $theme_data->get( 'ThemeURI' );    // Theme URI
echo $theme_data->get( 'Description' ); // Theme Description
echo $theme_data->get( 'Author' );      // Author Name
echo $theme_data->get( 'AuthorURI' );   // Author URI
echo $theme_data->get( 'Version' );     // Theme's Version
echo $theme_data->get( 'Template' );    // Parent Theme's Folder Name
echo $theme_data->get( 'Status' );      // Theme Status (If the the theme is active)
echo $theme_data->get( 'Tags' );        // Theme's Tags
echo $theme_data->get( 'TextDomain' );  // Theme's Text Domain
echo $theme_data->get( 'DomainPath' );  // Path to Translation Files

?>

 

0 Comments

Leave a Comment.