Last active
November 15, 2017 14:12
-
-
Save jasonrhodes/6168618 to your computer and use it in GitHub Desktop.
Once you load WordPress in via Composer (using the GitHub WordPress/WordPress mirror and Composer's "package" repository type), you have to solve a few directory path problems. This Composer script solution helps WordPress find your config file kept in your /config/ directory (You can easily change that path in the bin/wp-config-redirect script)
This file contains 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 characters
<?php | |
/** | |
* Load WordPress | |
* | |
*/ | |
define('WP_USE_THEMES', true); | |
require 'vendor/wordpress/wordpress/wp-blog-header.php'; |
This file contains 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 characters
{ | |
"repositories": [ | |
{ | |
"type": "package", | |
"package": { | |
"name": "wordpress/wordpress", | |
"version": "3.6", | |
"source": { | |
"url": "https://github.com/WordPress/WordPress.git", | |
"type": "git", | |
"reference": "3.6" | |
} | |
} | |
} | |
], | |
"require": { | |
"wordpress/wordpress": "3.6" | |
}, | |
"scripts": { | |
"post-install-cmd": "bin/wp-config-redirect", | |
"post-update-cmd": "bin/wp-config-redirect" | |
} | |
} |
This file contains 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 characters
<?php | |
require dirname(__DIR__) . '/bootstrap.php'; |
This file contains 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 characters
#!/usr/bin/env bash | |
######################################################################## | |
# Solves a problem with WordPress being kept in the Composer-managed | |
# vendor directory, where it looks for wp-config.php only one level | |
# up from the wp directory. After composer install/update, we run this | |
# command to create a dummy wp-config.php file that includes our real | |
# config file, managed in the /config directory (duh). | |
######################################################################## | |
echo "<?php require dirname(dirname(__DIR__)) . '/config/wordpress.php';'" > "vendor/wordpress/wp-config.php" |
Just a small typo:
echo "<?php require dirname(dirname(__DIR__)) . '/config/wordpress.php';'" > "vendor/wordpress/wp-config.php"
should be:
echo "<?php require dirname(dirname(__DIR__)) . '/config/wordpress.php';" > "vendor/wordpress/wp-config.php"
Also:
$ cd public
$ ln -s ../vendor/wordpress/wordpress/wp-login.php wp-login.php
$ ln -s ../vendor/wordpress/wordpress/wp-includes wp-includes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So far, the only other thing we've had to do to make this work is:
$ cd public $ ln -s ../vendor/wordpress/wordpress/wp-admin wp-admin