2

am looking for a solution to stop coding like a cow boy on WordPress

I want to put a versioning system (git or bitbucket) With a Development, Staging, and Production site. Something like this

dev.site.com

staging.site.com

site.com

or

site.com/dev

site.com/staging

site.com

If possible is there a plugin or system to push from one version to an other.

Without having the database problem?

If you what to advise me on any program that I can use for that purpose on ubuntu.

Thanks for your help?

1

2 Answers 2

1

There's a good article at WP Tavern that suggests some good methods. There is also a plugin called WP Pusher.

With regard to using the different domains, like dev, staging, production, etc. you could set up different remote repos for dev, staging, production, etc. And then you can push to them individually depending on what stage of development you are in.

However, if you are using Ubuntu locally, I would set up a quick LAMP stack for your development environment. That way, you could see changes live without needing to push to your remote repo each time you make a change.

0

If you're using a Mac, check Homebrew which creates an awesome local environment.

I'd recommend you define an ENV constant in the each environment's wp-config.

  • For dev: define('ENV', 'dev' );
  • For stage: define('ENV', 'stage' );
  • For accept: define('ENV', 'accept' );
  • For live: define('ENV', 'live' );

To make sure your non-live environments are not being indexed, you could use a simple function like this, which sets your blog to non-public, when the ENV is not set to live.

function set_robots() {
    $blog_public = get_option('blog_public');
    if ( ENV == 'live' ) {
        if ( $blog_public == 0 ) {
            update_option('blog_public', 1);
        }
    } else {
        if ( $blog_public == 1 ) {
            update_option('blog_public', 0);
        }
    }
}
add_action( 'admin_head', 'set_robots' );
2
  • Homebrew just is a way to install a lot of other programs - how does it help with WordPress specifically? What programs should be installed using brew?
    – Jen
    Commented Nov 26, 2016 at 1:18
  • I might have read it a bit hastily... in terms of Wordpress homebrew doesn't do a lot...
    – Beee
    Commented Dec 4, 2016 at 3:19

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.