Skip to content

Instantly share code, notes, and snippets.

@jcklpe
Last active November 21, 2018 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcklpe/cd9c7097b744a864dc38b9fe25fec07c to your computer and use it in GitHub Desktop.
Save jcklpe/cd9c7097b744a864dc38b9fe25fec07c to your computer and use it in GitHub Desktop.
Create new wordpress project with Composer
#install composer if you haven't
curl -sS https://getcomposer.org/installer | php
// Use this composer config to install wordpress
{
"name": "Jackalope",
"authors": [{
"name": "jcklpe",
"email": "david@jackalope.tech"
}],
"type": "project",
"repositories": [{
"type": "composer",
"url": "https://wpackagist.org"
}],
"require": {
"php": ">=5.4",
"johnpbloch/wordpress": "*"
},
"extra": {
"wordpress-install-dir": "wp"
}
}
# install packages using composer
composer install;
# move wp content, index.php and config up to root folder
cp -R wp/{wp-content,index.php,wp-config-sample.php} .;
# rename config file
mv wp-config-sample.php wp-config.php;
#Then modify wordpress index.php file so that it points to the correction header file
require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );
#Add these to wp-config.php
define('WP_CONTENT_DIR', __DIR__ . '/wp-content');
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp-content');
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp');
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']);
#delete garbage
rm public/wp-content/plugins/hello.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment