I’ve had a bad habit. Lots of time when I do WordPress development, I just work on the live site. I open Cyberduck and go to the wp-content directory, click the edit button and start working on the code.
This is the wrong way.
Recently a client mentioned that when I did some new fixes could I make sure I don’t leave things looking weird on the site. I then realized I’d been doing in this wrong. For a very long time.
The right way is to do development on another machine and just push tested final code to the live site. That’s the way we’re doing it going forward.
WordPress Local Development Made Easy
One of the reasons I did things the wrong way is how hard it is to set up a local WP install for development if you have multiple sites you need to work on. You have to set-up different database tables and prefixes, put each install in a different directory, and lots of other minutia. Then you will never have a completely clean environment because there are multiple installs in the same place.
I’ve started using Vagrant quite a bit in development. It lets you easily create virtual machines and configure them. You can also recreate these machines easily because all the create is scripted and saved via the Vagranfile.
VagrantPress is a Vagrant box that creates a linux VM, then installs everything you need to run WordPress. Then it installs WP in your vagrant directory so you can directly edit the WordPress install.
It is as easy to install as they say on their home page. Just three steps, assuming you already have Vagrant set up.
I did a couple of things different.
I did a git clone of VagrantPress since I don’t have wget installed on my laptop.
I also modded the vagrantfile slightly to use a 32 bit Linux base box I already had on my machine to avoid another long download.