Last active
February 11, 2019 20:49
-
-
Save CMCDragonkai/468c7ea7a1a2e9eb386fb0626fafc0c3 to your computer and use it in GitHub Desktop.
Revisions
-
CMCDragonkai revised this gist
Jul 19, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,8 +41,8 @@ Then create a `wp-config.php` at root that looks like: ```php <?php define('WP_ENV', 'development'); define('ABSPATH', __DIR__ . '/wp/'); define('WP_HOME', 'localhost'); define('WP_SITEURL', 'localhost'); define('WP_CONTENT_URL', 'localhost/wp-content'); -
CMCDragonkai revised this gist
Jul 14, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -91,7 +91,7 @@ Run `cp -r wp/wp-content/themes wp-content/themes'`. Setup the database and configure your `wp-config.php` to connect to it. Now run `php -S "127.0.0.1:1337" -t .`. Do not use `index.php` as the router! Wordpress is not arranged in the front-controller pattern. Remember that by using the site url and home constants in `wp-config.php`, the site url and home options in the administration backend become useless -
CMCDragonkai revised this gist
Jul 14, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -101,6 +101,7 @@ it to your environment. Also you need a `.gitignore`: ``` /vendor/ /wp/ /wp-config.php /wp-config.*.php -
CMCDragonkai revised this gist
Jul 14, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -70,6 +70,7 @@ define('SECURE_AUTH_SALT', ''); define('LOGGED_IN_SALT', ''); define('NONCE_SALT', ''); require_once('vendor/autoload.php'); require_once(ABSPATH . 'wp-settings.php'); ``` -
CMCDragonkai revised this gist
Jul 14, 2017 . No changes.There are no files selected for viewing
-
CMCDragonkai revised this gist
Jul 14, 2017 . 1 changed file with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -95,4 +95,19 @@ Now run `php -S "127.0.0.1:1337" -t .`. Remember that by using the site url and home constants in `wp-config.php`, the site url and home options in the administration backend become useless and can be left as just `localhost`. The constants are better as you can specialise it to your environment. Also you need a `.gitignore`: ``` /wp/ /wp-config.php /wp-config.*.php !/wp-config.sample.php /wp-content/debug.log /wp-content/cache/ /wp-content/uploads/ /wp-content/plugins/ ``` The `wp-config.php` now acts as your environment file as well. -
CMCDragonkai created this gist
Jul 14, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,98 @@ Integrating Wordpress with Composer =================================== Setup the project directory: ```sh mkdir wordpress-composer cd wordpress-composer ``` You need a `composer.json` that looks like this: ```json { "name": "wordpress-composer", "repositories": [ { "type": "composer", "url": "https://wpackagist.org" } ], "require": { "johnpbloch/wordpress": "^4.8.0", "wpackagist-plugin/w3-total-cache" : "^0.9.5.4" }, "extra": { "wordpress-install-dir": "wp" }, "autoload": { "files": [] }, "minimum-stability": "dev", "prefer-stable": true } ``` Run `composer install`. Then create a `wp-config.php` at root that looks like: ```php <?php define('ABSPATH', __DIR__ . '/wp/'); define('WP_ENV', 'development'); define('WP_HOME', 'localhost'); define('WP_SITEURL', 'localhost'); define('WP_CONTENT_URL', 'localhost/wp-content'); define('WP_CACHE', false); define('WP_DEBUG', true); define('WP_DEBUG_LOG', false); define('WP_DEBUG_DISPLAY', false); define('WP_ALLOW_REPAIR', false); define('DB_NAME', 'wordpress-composer'); define('DB_USER', 'root'); define('DB_PASSWORD', ''); define('DB_HOST', '127.0.0.1'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); $table_prefix = 'wp_'; // generate with https://api.wordpress.org/secret-key/1.1/salt/ define('AUTH_KEY', ''); define('SECURE_AUTH_KEY', ''); define('LOGGED_IN_KEY', ''); define('NONCE_KEY', ''); define('AUTH_SALT', ''); define('SECURE_AUTH_SALT', ''); define('LOGGED_IN_SALT', ''); define('NONCE_SALT', ''); require_once(ABSPATH . 'wp-settings.php'); ``` Remember that Wordpress is not arranged in a front-controller pattern. This means anything constants and configuration that needs to exist at all places (like at wp-admin), must be placed in the `wp-config.php`. Create an `index.php` like: ```php <?php define('WP_USE_THEMES', true); require(__DIR__ . '/wp/wp-blog-header.php'); ``` Run `cp -r wp/wp-content/themes wp-content/themes'`. Setup the database and configure your `wp-config.php` to connect to it. Now run `php -S "127.0.0.1:1337" -t .`. Remember that by using the site url and home constants in `wp-config.php`, the site url and home options in the administration backend become useless and can be left as just `localhost`. The constants are better as you can specialise it to your environment.