Testing WordPress Themes Online

Editing and testing changes to a WordPress theme is certainly frustrating when using the default online editor. This is specially true when editing the active theme. WordPress doesn't offer any option to test drive your changes before they go live. Being used to edit CSS files offline, the first thing that came into my mind was to replicate the WordPress site offline and then upload the files via FTP. However, I ended up doing my editing and testing online for several big reasons.

Why Not to Test Offline

First of all I have to make clear that I have nothing against testing offline. However, there are several reasons why testing offline may be harder for the vast mayority of WordPress users:

  1. Replicating a WordPress site offline is not straightforward. Copying the files, the database and reconfiguring wp-config.php is not enough. You'll also have to edit the database or add some lines to your wp-config.php to redefine base and home URLs and reset the permalink settings (if you get an Internal Server Error). Even then, some things might break because references to your domain will remain in the database.
  2. If you replicate the database, you'll be working with outdated content, unless you are regularly backing up and restoring, which is tedious.
  3. You may use the same database the live site uses if your hosting provider allows Remote Access. However, enabling remote access will make your database less secure. Some hosting providers do not allow it and some (like GoDaddy) offer the option only on creation of the database. If this setting is disabled, you'll have to backup and restore your database into a new one. Even if you get it to work, you'll be limited to template changes. Anything that changes the database will also affect your live website.
  4. You'll have to be using FTP to upload your changes. This is not only an extra step. It also means you won't be able to upload your changes easily without your FTP client and account set up.

Testing Online

The two biggest cons of using default WordPress to edit themes are the lack of testing capabilities and the lack of syntax highlighting. Thankfully WordPress plugins can make both editing and testing WordPress themes online much more practical by adding both features.

Users won't notice

Theme Test Drive is a WordPress plugin that allows the administrator to test a theme while the users use the default one.

WordPress Theme Test Drive Plugin

Theme Test Drive even allows setting an access level for editors, authors and contributors to test drive the theme. Combine it with WordPress Duplicate Theme Plugin (a simple plugin which simply duplicates an existing template) and you don't have to leave the Administration Panel to copy, edit, test and activate theme changes.

WordPress Duplicate Theme plugin

Simply copy your active theme using Duplicate Theme, enable Theme Test Drive on the copied theme, do your changes, and activate it when it's ready (as usually, from Appearace -> Themes). This way you also keep the old themes and may roll back at any moment.

Syntax Highlighting

A huge annoyance of the WordPress editor is the lack of Syntax Highlighting. Thankfully a simple plugin will rescue us again. The Advanced Code Editor plugin enables PHP, HTML, CSS and JS syntax highlighting in the integrated themes and plugins source code editors:

WordPress Advanced Editor plugin

The three plugins reviewed above are all high rated plugins I tested myself. I don't see a reason to mess up with offline testing after making up for the admin panel's missing features. However there may be cases where offline editing is the answer. I would consider offline editing when creating a first template, for example. There won't be much trouble when moving an almost empty database and offline editing is certainly faster. Slow connections will also make online testing terribly frustrating.

I hope the article was of help. Please share your thoughts and experiences in the comments below. How do you test WordPress themes?

One comment

  1. Thank you for this info! I was looking to test it offline and envisioning the pain in the neck its going to be, but will try this plugin. Thanks again!

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>