Home > Wordpress Plugins > WordPress – preview and modify a theme till we are satisfied

WordPress – preview and modify a theme till we are satisfied

January 11th, 2011 Leave a comment Go to comments

Since we at Saturn provide wordpress as a CMS, and have more than a handful of experienced WordPress customizers, and themeres we have handled several challeges related to WordPress. The latest one being that the client was offered a facelift, and they wanted to preview the progress of integration. I searched the plugin repositories and blogs, found a lot of solutions, which include theme switchers, theme preview, and even suggestions to have a local copy. Well with our client, we could not think of a local copy, since the database dump itself was about 320GB and the images and videows was a whopping 1200 GB. Well after reading through the source of get_option, a wave struck me.



function new_theme_preview(){
    if(isset(
$_COOKIE['ShowNewTheme'])){
        return 
'myNewTheme';
    }
    return 
false;
}
 
add_filter('pre_option_current_theme''new_theme_preview'10);
 


I added the above to the end of an active plugin, then created two files newtheme.php and oldtheme.php, containing code to set and remove the cookie. The files were put into the top level folder. Once I am done with the theming, I could remove all these manually.

// newtheme.php
setcookie 'ShowNewTheme''1');
header("Location: ./");
 
//oldtheme.php
setcookie 'ShowNewTheme'false);
header("Location: ./");
 

  1. charles
    July 13th, 2011 at 12:52 | #1

    http://localhost/example.in/images/GE/GE/

    how do i remove the last GE/
    this GE can vary – could be wipro/ or philips/

  2. July 19th, 2011 at 14:26 | #2

    No idea what you are talking about. Does it have something to do with WordPress ?

  1. No trackbacks yet.

sixty nine + = seventy two