How to test a new wordpress theme without activating it
23 Aug
So you have a working WordPress based site and you are really happy with it until one day you add some new content and when checking the result you think to yourself “man this design is getting really old and out of fashion”.
What follows is a cycle of redesign which by itself is followed by coding the new design into a theme, and then you reach the point where you like to test your design with “live” data. For small sites it is possible to simply export all the posts, or the entire DB if you have fancy plugins, and import it into your testing environment, but for big enough sites it might be a difficult task running against space and time limitations imposed on the usual exporting tolls.
Hey, who am I kidding, I like any other decent programmer prefer to develop instead of setting up test environments, and the faster I can get my code to the server the better I feel. For me the best thing is to do most of the development on the live server.
The main obstacle for testing new themes on the server is the fact that only one theme can be active at any given time*, which means that you can not test without disrupting the look and usage for the normal users of the site.
To the rescue comes a feature which was introduced in version 2.7 – the theme preview. When you use the themes management it shows you the way the site will look when you will activate a theme, and this can be used to test a theme without activating it. All you have to do is log in as an admin, or any user which has a ‘switch_themes’ capability, and browse the following url:
Yoursite?preview=1&template={name of template}&stylesheet={name of theme}
Where {name of template} should be replaced with the name of the directory in which the main theme is located and {name of theme} should be replaced if with the name of the child theme being used. If you don’t use a configuration of base and child themes, then you don’t have to specify the stylesheet parameter.
And what about testing the admin related changes if you have any? The only advice I have is to try and avoid the urge to reuse the names of the options which were used in the old theme. In the price of having to do some extra configuration, it will make testing on the server a lot safer and will keep your ability to revert to the old theme at any time.
* One day someone will write a plugin to fix this, but for version 2.8 this is the situation.
Hi,
Congrats on the new blog.
Did you try the Theme Test Drive plugin (and there are others)?
Elad, but this is without any plugins
. It seems to me that the plugin was actually not useful since version 2.7 in which this preview functionality was introduced.
In its original version the plugin is worse since you had to select the theme which you are going to work with, which eliminated your ability to view the old design without logging out, which means that you had to open a second browser if you needed to compare anything.