Best of Sage and Twig in one Theme
Clone or download
Pull request Compare This branch is 2 commits ahead of studiorabota:develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
lang
lib
templates
vendor
.bowerrc
.editorconfig
.gitignore
.jscsrc
.jshintrc
.travis.yml
404.php
CHANGELOG.md
CONTRIBUTING.md
LICENSE.md
README.md
bower.json
composer.json
composer.lock
functions.php
gulpfile.js
index.php
package.json
page.php
ruleset.xml
screenshot.png
search.php
single.php
style.css
template-custom.php

README.md

Sage + Twig theme for Wordpress

Sage is a WordPress starter starter theme with a modern front-end development workflow. Twig is a modern template engine.

The Sage + Twig starter theme combines the best of both.

Do check out the Timber Wiki. It will help you to learn Twig and how to set it up with Wordpress.

Theme installation

Clone the git repo - git clone git@github.com:studiorabota/sage-twig-theme.git and then rename the directory to the name of your theme or website.

Theme setup

Edit lib/setup.php to enable or disable theme features, setup navigation menus, post thumbnail sizes, post formats, and sidebars.

Installation

You will need:

  • Gulp
  • Bower
  • Composer
  • Node - We recommend you update to the latest version of npm: npm install -g npm@latest.

From the command line:

  1. Navigate to the theme directory, then run npm install
  2. Run bower install
  3. Run composer update to install the Timber plugin
  4. Run gulp
  5. Open assets/manifest.json and set devUrl to your domain name (ex. project-name.dev)
  6. Run gulp watch
  7. Go to Plugins in wp-admin and activate Timber

You now have all the necessary dependencies to run the build process.

Adding extra data to Twig

In lib/timber.php you can add extra data to be used in your Twig templates. This is only for data which needs to be available site-wide, like menus, etc.

You can also add data in for ex. page.php, archive.php, etc. For this you should check out the Timber documentation.

Using BrowserSync

To use BrowserSync during gulp watch you need to update devUrl at the bottom of assets/manifest.json to reflect your local development hostname.

For example, if your local development URL is http://project-name.dev you would update the file to read:

  "config": {
    "devUrl": "http://project-name.dev"
  }

Documentation