• I made a small modification to the Theme Switcher plugin and I though I’d share.

    It adds <em> (Default)</em> (<em> (Default)</em>) after the name of the default theme. I coulda modified it better by changing one or two of the if’s, but I didn’t want to edit any code, I just wanted to do it via adding some code.

    So anyway, here’s my simple code if anyone cares:

    Starting on line 140…

    if ((!empty($_COOKIE["wptheme" . COOKIEHASH]) && $_COOKIE["wptheme" . COOKIEHASH] == $theme_name)
    || (empty($_COOKIE["wptheme" . COOKIEHASH]) && ($theme_name == $default_theme))) {
    $ts .= ' <li>'.$display.'</li>'."n";

    } else {
    $ts .= ' <li><a href="'
    .get_settings('home').'/'. 'index.php'
    .'?wptheme='.urlencode($theme_name).'">'
    .$display.'</a></li>'."n";

    Change to…

    if ((!empty($_COOKIE["wptheme" . COOKIEHASH]) && $_COOKIE["wptheme" . COOKIEHASH] == $theme_name)
    || (empty($_COOKIE["wptheme" . COOKIEHASH]) && ($theme_name == $default_theme))) {

    // Begin Viper007Bond edit
    if ($theme_name == $default_theme)
    $ts .= ' <li>'.$display.' <em>(Default)</em></li>'."n";
    else
    // End Viper007Bond edit

    $ts .= ' <li>'.$display.'</li>'."n";
    } else {

    // Begin Viper007Bond edit
    if ($theme_name == $default_theme)
    $ts .= ' <li><a href="'
    .get_settings('home').'/'. 'index.php'
    .'?wptheme='.urlencode($theme_name).'">'
    .$display.' <em>(Default)</em></a></li>'."n";
    else
    // End Viper007Bond edit

    $ts .= ' <li><a href="'
    .get_settings('home').'/'. 'index.php'
    .'?wptheme='.urlencode($theme_name).'">'
    .$display.'</a></li>'."n";

    Sorry, but no preview of it yet as my new WP powered blog is still only on my computer, but I can verify that it works. ??

  • The topic ‘My “Theme Switcher” Plugin Modification’ is closed to new replies.