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

Brian Hayes
Brian Hayes
20,986 Points

WP-CLI in VVV: targeting the correct WP Install.

I've just recently switched from MAMP to a VVV local development environment. So I'm still learning my way around Vagrant and the VVV configuration. Let me also add that I'm not all that seasoned with the command line, so I'm bound to make a lot of newbie mistakes.

VVV comes with a few WordPress installs out of the gate, but as i wanted to use VVV while following the WordPress Theme Development course, I went ahead and and created another install called "treehouse."

Now I'm trying to use WP-CLI to execute commands to affect that install, for instance, trying to activate the treehouse-portfolio theme. I used the ssh command in vagrant at vagrant-local directory and then tried to run WP-CLI commands. I then realized that this was foolish as there were multiple installs and theres no way it could know which one to affect. I tried to define the path, but i guess i kept screwing up.

So how do i open up an ssh and have it set to the correct WordPress install in VVV?

3 Answers

Eliel Kiiskinen I would recommend putting all your sites in one VVV. This will save lot's of space on your harddrive. Unless you have some crazy server configuration that needs testing, there is no reason to break them up into separate boxes. As far as setting that up I would recommend using a site creation wizard such as Variable VVV (also known as just simply "VV" - https://github.com/bradp/vv).

Brian Hayes
Brian Hayes
20,986 Points

I kinda figured it out on my own. My mistake seems to be extremely newbie-ish...

Once you ssh into the virtual server (i did this in terminal at the vagrant-local) you have to cd into the directory. In the VVV documentation on the GitHub page there's a section where the VVV path is listed for each of the default WordPress installs. So just use that path and replace the last directory with the one you want. so cd srv/www/*desired directory here*

So for example I had the install for Treehouse named "treehouse" so i did cd srv/www/treehouse. Once I did that my theme activate command worked just fine.

So in the end I guess it was basic Command Line principles that I guess I just didn't think about for some reason.

Eliel Kiiskinen
Eliel Kiiskinen
16,950 Points

Thanx Joey for the helpfull reading! Ive just started to use VVV and it seems quite nice, how ever I'm not sure if I'm supposed to have a new VVV for every WP site I build or should I have all sites in one VVV? Which do you prefer? My sites are just simple WP themes, so no special configurations.