0

Need to use a new theme for one of my Wordpress websites, but at the same time I need to also keep the current theme live whilst I make changes. What is the best practice?

Should I develop the theme locally first? But that still doesn't help 100% because I need to make changes specific to the categories and posts that exist on the live site.

Should I:

So should I develop the theme locally then make those changes specific to my website on the live server (with a "under construction" page on while I make the changes)??

2
  • 1
    why not copy your live data to a local server?
    – Milo
    Commented May 18, 2014 at 23:30
  • Yep, develop locally until you have finished and then upload the new theme to your live server where you can test how your content looks on your new theme. Or copy your entire installation locally. Commented May 19, 2014 at 8:11

1 Answer 1

1

Developing locally is best practice in virtually all cases.

Getting a working replica of your site to develop on locally is pretty easy.

Wordpress consists of some files (php, scripts etc) and also a database. We need to copy both to your local dev environment, and make a few changes so that it runs in its new 'location'.

1st, I'd recommend using this plugin to export your database. It will change the URI's, GUIDs etc that cause WP sites to break when you move them, and it will catch those stored within serialised arrays (which running regular SQL find/replace queries will not).

Migrate DB Plugin on WordPress.org

Now you have the SQL dump, you'll need to import that into your database in your local dev environment.

Next, we need to copy all the files (including hidden i.e: .htaccess) from your live server to your local dev environment - this can be done any number of ways, but FTP is probably the most common.

Now we should have files AND the database, the last step is to change the wp-config.php file so that it contains the credentials for your local database (this will have a different name, user, password etc).

To up your game, check out this blog post by Mark Jaquith on using a wp-config-local.php file to store your local dev credentials, and using a small MU plugin he wrote to disable certain plugins in your local dev environment - this can be great for turning off things like W3-cache (if you use it)

Local Dev Tips: DB & Plugins by Mark Jaquith

Final words of advice - some plugins put stuff in your wp-config or .htaccess file: iThemes security and w3-total cache are two I see trip a lot of people up. Sometimes these plugins add domain specific things (cookie domain, redirect rules with the URL hardcoded etc) to these files, so if nothing is working, take a look at either of those two files.

I hope this is enough to get you started developing locally, it's always better to work with data imported from the actual site than to just spin up a fresh WP install and hope it all works the same when you push to production.

2
  • thank you for that very detailed response. I have one more "dumb" question. Migrate DB plugin will not make any changes to my EXISTING db will it? Will just export a new version of my DB with the replaced stuff, leaving the current database unchanged?
    – user51824
    Commented May 19, 2014 at 0:53
  • Yes, precisely. It only makes changes to the SQL file you download, it will not make any changes to your existing DB.
    – aj-adl
    Commented May 19, 2014 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.