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.

<?php
$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: WordPress Codex

Today In History

  •  
  •  

Comment

Leave a Reply

Note: Convet HTML, PHP, JavaScripts from Postable, before posting from comment section.
License: By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution. Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.