1. Go to this page and download the library: Download dnaber/wp-provisioner library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dnaber / wp-provisioner example snippets
# -*- coding: utf-8 -*-
namespace WpProvision\Api;
/**
* @param \WpProvision\Api\WpProvisioner $api
* @param \WpProvision\Api\WpCommandProvider $wp
* @param \WpProvision\Api\ConsoleOutput $output
*/
return function( Versions $versions, WpCommandProvider $wp, ConsoleOutput $output ) {
// add a provision routine named '1.0.0'. The VersionList contains all provision routines for all versions
$versions->addProvision(
'1.0.0',
function() use ( $wp, $output ) {
$admin_email = '[email protected]';
$admin_login = 'david';
// install a multisite
$wp->core()->multisiteInstall(
"http://myproject.net",
[ 'login' => $admin_login, 'email' => $admin_email ]
);
// create some sites
$site_1_id = $wp->site()->create(
"http://de.myproject.net/",
[ 'user_email' => $admin_email ]
);
$site_2_id = $wp->site()->create(
"http://fr.myproject.net/shop/",
[ 'user_email' => $admin_email ]
);
// install some plugins (they usually should be as you're using composer, aren't you?)
$wp->plugin()->activate(
[ 'woocommerce', 'akismet' ],
[ 'site_url' => 'http://fr.myproject.net/shop/' ]
);
$wp->plugin()->activate(
'multilingual-press',
[ 'network' => TRUE ]
);
$output->writeln( "Successfully set up version 1.0.0" );
}
);
};