Ninedays Is Getting a Makeover


I've been doing a bit of updating to the site lately and I've decided this blog needs a make-over. I think, as usual, I'm going to start from a pre-made WordPress theme and modify the crap out of it.

In the past when I do a WordPress overhaul I used to just modify the site from the front end. Now that I'm seeing between 170-380 unique visitors a day I know I can't just mess with the front end of the site I'm going to have to modify the theme in a development environment to get all the bugs out first.

Setting up a Development WordPress Theme

I use the WordPress plugin theme switcher reloaded and a little WordPress magic to only display the switcher if someone is logged into the WordPress admin.

This already exists in my functions.php file:

PHP

<?php
if(!function_exists('is_preview_mode')){
    function is_preview_mode(){
        if(is_user_logged_in()){
            $result = true;
        } else {
            $query = $_SERVER['QUERY_STRING'];
            $pattern = '/(((p=([0-9]*)&)?preview=true)|(p=([0-9]*)))/';
            $result = preg_match($pattern, $query);
        }
        return $result;
    }
}
?>

So after installing the theme switcher plugin all I had to add to my current WordPress theme's footer.php file was:

PHP

<?php 
    if(function_exists('is_preview_mode') && function_exists('wp_theme_switcher')){
        if(is_preview_mode()){
            wp_theme_switcher();
        }
    }
?>

REMEMBER

While you are testing be sure to turn caching off on the blog so no one sees your cached version of a page using the new theme!

And tada! I, when logged into the WordPress admin I can switch to my test theme and get that all wrapped up before pushing the new look live.

One of my new favorite tricks!

Popularity: 53% [?]


Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Be the first to leave a comment!