Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

John Locke
John Locke
15,479 Points

Here's a WordPress development question

Say I'm working on a WordPress client site for someone else. They already have a live site, but want to replicate that entire site in a brand new development area. How would YOU go about moving the theme over to a local development area? I'm curious to hear everyone's solution to this.

5 Answers

Alexander Sobieski
Alexander Sobieski
6,555 Points

There are several ways:

If you just want the theme, you can go into the theme folder via FTP and copy/paste the files into your dev site.

If you want to get an exact replica of your client's whole site:

Install a plug-in called DUPLICATOR (Back-up buddy and Manage WP are premium[paid] apps that do this, but have extra features that are cool).

Create a back-up and download the backup file (don't forget to download the install script).

Place them in the directory folder where you want to install WP. (if you're running locally, you need MAMP for mac or XAMPP for windows) -- if you're going to be on a dev server (dev.yourdomain.com/client-site1 -- for example), FTP the zip file and install.php into the directory for your dev site.

Go to your PHPMYADMIN or if in cPanel the mysql database wizard - create a database and remember the user, pw, and db name

Next go to localhost:8888/your-directory/install.php (if on a mac) --OR-- dev.yourdomain.com/client-site1/install.php

Key in all the database info - run the script -- boom... exact copy.

NOTE: if you're in the development phase for a while (as in, several comments, posts, pages, etc. get modified or added) -- use the TOOLS > EXPORT in the dashboard to export content from the live site and TOOLS > IMPORT in the dev site, so you can sync-up the content.

ALTERNATELY --

Copy/paste all the files into your new directory, export the sql database - then, import the database into the dev environment. Change the info in wp-config.php and open the .htdocs folder in a text editor... replace all instances of "http://yourclientsiteurl.com" with "http://yourtestsiteurl.com" (or "localhost:8888/test-site" if on a mac, using mamp).

Alternately -- Look into child themes on the wordpress codex

John Locke
John Locke
15,479 Points

There is a reason I asked this question. I went through this situation recently at a studio where I was filling in for only a few days (No other developers were there). I had to get a replica of the living site, as all of the different types of content I had to work with. Copying the site to a local dev area left me unable to log-in, and I did not know about Duplicator previous to this. I've used BackupBuddy before, but I don't have a current license.

I'm just trying to figure out what I could have done differently on that day.

Alexander Sobieski
Alexander Sobieski
6,555 Points

aaahhh...

That sounds frustrating.

Wait... so you had access to the live site, but didn't have access when copy/pasting to the dev environment? -- did the DB not copy over?

Yeah -- Duplicator has helped me a time or 50. I used b-buddy for a year or so, but now I use ManageWP (since I can access/xfer/etc. both the live and the dev site at the same time). -- kinda sexy.

What did you end up doing?

John Locke
John Locke
15,479 Points

I ended up working on the live site. It wasn't my first, second, or third choice.

The weird part is that there were two folders on the client site named "dev" and "dev2", which I could see when I was on FTP, but no one had the logins for these Worpdpress installs (not the same as the client log ins).

The next day they had a local dev area set up, but I'm not sure why they didn't before? I suppose that the dev folders I saw could have been old, from years ago and the last team to build the site. The whole experience just made me feel rather stupid.

I will check out Duplicator and ManageWP. I hadn't heard of those before, but they sound very useful.

Thanks for your help, Alexander, and let me know if I can ever help you out in the future.