Displaying Current Theme Related Information

WordPress has a simple built in function to display current/active theme related information on both the front and back end. The function itself returns an instance of the theme object and can display various information based on the parameter. Here is the function.

<?php wp_get_theme(); ?>

Once we initialize the function we can assign a variable to the function and then we can echo the theme related information we want to display. Here is how you can do that.

$mytheme = wp_get_theme();
echo $mytheme->get('Name');
echo $mytheme->get('ThemeURI');
echo $mytheme->get('Description');
echo $mytheme->get('Author');
echo $mytheme->get('AuthorURI');

This list can get even longer based on the parameter you are using and the information you want to display. You can find a comprehensive list of parameters for this function from the WordPress codex page and use them anywhere you want.

Reference: wp_get_theme


Commenting is disabled.