Show information about the currently activated theme

May 4, 2007

In WP normally you hardcode information about the current theme showing link to author’s site, version and name etc. Information is stored in the CSS file of that WP theme. In Habari information is stored in a xml file in the theme folder and you could allow users of your theme to extract information from there.

Class ThisTheme extends Theme
function show()
$activetheme_name = Options::get('theme_dir');
$thistheme_path = HABARI_PATH.'/user/themes/'.$activetheme_name;
$thistheme_info = simplexml_load_file($thistheme_path.'/theme.xml');
$output = "This Theme: ".$thistheme_info->name;
$output .= " ".$thistheme_info->version." by ";
$output .= "[a href=\"".$thistheme_info->url."\"]".$thistheme_info->author."[/a]";
$output .= " for ".$thistheme_info->template_engine;
echo $output;

Copy the above into your theme.php file of your theme and add [?php ThisTheme::show(); ?] to your footer perhaps on a new line.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: