- WordPress itself is a submodule
- wp-config.php, plugin folders and theme files are in the repository root. wp-config.php has been updated to point to these.
- see https://davidwinter.me/install-and-manage-wordpress-with-git/ for more info on the WordPress set up
PHP requirement is in order to run the site. Node, gulp and Bower requirements are for development only.
Prerequisite | How to check | How to install |
---|---|---|
PHP >= 5.4.x | php -v |
php.net |
Node.js 0.12.x | node -v |
nodejs.org |
gulp >= 3.8.10 | gulp -v |
npm install -g gulp |
Bower >= 1.3.12 | bower -v |
npm install -g bower |
$ mkdir ocs
(or whatever you like)$ git clone {this repo url} ocs
$ git submodule init
# Get WordPress$ git submodule update
.
- Create a database
- Import the existing database however you like. Easist, particularly with a large DB + MAMP is with WP-CLI:
$ wp db import /path/to/data.sql
- Copy
local-config-sample.php
tolocal-config.php
- Edit
local-config.php
and add you database connection details - If this is a production environment, change the
WP_ENV
constant toproduction
- [optional pt 1] Add an entry to /etc/hosts for ocs
- [optional pt 1] Create a vhost for OCS (for MAMP that's in
/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
) - Restart Apache
- Wordpress Admin is at /wordpress/wp-admin.php
Custom code for the OCS currently lives in two places:
/app/plugins/ocs-site-customizations
: most OCS-specific functional code belongs here instead of.../app/themes/odfw-ocs-sage/
: templates, CSS, JS and other site assets.
The OCS theme is built on top of the Sage starter theme. In order to develop CSS or JS you'll need to get the theme's tooling up and running. You can probably hack PHP without any further set up.
- Install Node and NPM. Cross platform install how-to. If you already have them installed, be sure to have the latest version of npm:
npm install -g npm@latest
- Install node dependencies for this project:
$ npm install --global gulp bower
- From the theme folder
$ cd app/themes/odfw-ocs-sage
- run
$ npm install
to have npm install additional theme dependencies - run
$ bower install
to install frontend dependencies
- run
- All set! From the theme folder run
$ gulp watch
to work on theme. gulp will start a server at http://localhost:3000/ and will watch all of the files in the theme. Any changes you make will be compiled automatically (from sass/js/php...) and your browser will automatically update to reflect the changes. Note that while the gulp server will serve assets and refresh PHP you still need to run a LAMP stack (or equivalent server).
gulp
— Compile and optimize the files in the assets directorygulp watch
— Compile assets when file changes are madegulp --production
— Compile assets for production (no source maps).
functions.php
is only a file includer. Please add functions to the included file you think is most appropriate. If a function defines core site functionality (things that shouldn't break no matter the theme), put it into the ocs-site-customizations plugin.- Unless most things in the WP universe, sage uses namespacing. In order to call a function you've defined elsewhere within the theme you'll need to understand a little bit how namespacing works. There's a good write up on the sage blog.
- Work on JS/SASS files within
/assets/
. Compiled equivalents are served from/dist/
. Do not edit files within/dist/
—your heart will be broken when gulp wipes them out. - More on sage, gulp, sass, and BrowserSync
$ cd /path/to/wordpress
$ git fetch -t
to get the most recent tags. Each release version of Wordpress is tagged.$ git tag
to see the list$ git checkout 4.3.1
or whatever the most recent tag is$ cd ..
Need to get out of the Wordpress directory for the next steps or you will melt poor little git's brain.$ git add wordpress
to stage the update$ git commit -m "Update Wordpress to 4.3.1"
Either use the admin panel or use WP-CLI. With WP-CLI installed, navigate to the /wordpress
folder and run (eg):
$ wp plugin update hello-dolly
or
$ wp plugin update --all