• I want to display the name of the theme currently in use. So I have (in sidebar.php) a call to the function get_current_theme(). But it always seems to display the name of the default theme, even when I theme-switch to a different theme.

    I can’t find any documentation on get_current_theme. Does it actually get the theme currently in use by the blog? If so, what is it that I’m missing, thus preventing the display of the right theme name?

    Thanks for any help,
    Andrew
    changingway.net

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here’s the code I presently use in my themes:

    <?php
    if (!empty($_COOKIE["wptheme" . COOKIEHASH]))
    $theme_name = $_COOKIE["wptheme" . COOKIEHASH];
    else
    $theme_name = get_current_theme();
    ?>

    <?php echo $theme_name; ?>

    This works if using Ryan’s ThemeSwitcher plugin (you may need to modify $_COOKIE for others). If you want to get additional info on the theme, add this to the end of the first code block:

    $theme = get_theme("$theme_name");

    And call it like so:

    <?php echo $theme['Author'];?>

    Thread Starter andwat

    (@andwat)

    Again, K, I thank you. It works fine. And thanks for the bonus info also.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting name of current theme’ is closed to new replies.