Skip to content

Instantly share code, notes, and snippets.

@shulard
Last active August 29, 2015 14:10
Show Gist options
  • Save shulard/75c45260591ce0401b3e to your computer and use it in GitHub Desktop.
Save shulard/75c45260591ce0401b3e to your computer and use it in GitHub Desktop.
24 jours de web: Comment bien versionner mon site WordPress avec Git et Github
#Installation Wordpress
/wp-cms/*
#Contenus non versionnés
/wp-content/uploads/
/wp-content/plugins/
#Configuration
/wp-config.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase "/"
#If the URL start with public stop redirect
RewriteRule wp\-cms\/index\.php$ - [L]
#If you request an URL it does not start with wp-cms
#Else the HTACCESS have done the redirect
#you can go to the index.php to execute code
RewriteCond %{REQUEST_URI} ^/wp-cms
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp-cms/index.php [L]
#wp-cms is not here so we add it :)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp-cms/$1 [L]
</IfModule>
git submodule add https://github.com/wordpress/wordpress wp-cms
<?php
/**
* Tells WordPress to load the WordPress theme and output it.
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require(dirname(__FILE__).'/wp-cms/wp-blog-header.php');
#Accès au répertoire qui va contenir le projet
cd /chemin/vers/mon
#Création du projet et initialisation
mkdir depot
cd depot
git init
git checkout git://yourhost/yourproject.git preprod
cd preprod
phing -Dbuild.env=PREPROD env:init
cd wp-cms
#Récupération de la dernière liste de tags
#(nécessaire pour accéder aux tags créés depuis la mise en place du projet)
git fetch --tags
git checkout 4.0.1
<?php
//wp-content se trouve dans le même répertoire que wp-config.php
//Pour une compatibilité PHP5.2, je n'utilise pas __DIR__
define('WP_CONTENT_DIR', dirname(__FILE__).'/wp-content');
//L'URL doit être absolue vers le répertoire wp-content
define('WP_CONTENT_URL', 'http://domain/path/to/wp-content');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment