Example WordPress theme using twig for theme and styleguide
Switch branches/tags
Nothing to show
Clone or download
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.
child-theme
normal-theme
twig-theme
README.md
twig-cape.jpg

README.md

WordCamp Bristol 2017 talk project files

Get Twig. Use Twig. Smile.

Talk slides https://slides.com/codekipple/get-twig-use-twig-smile.

Three example themes for you to play with:-

  • Twig - Uses Twig via the Timber plugin. Includes an integrated styleguide via Spress.
  • Child - Child of Twig theme, demonstrates how you can override twig templates in child themes.
  • Normal - Same design as the Twig theme but no Twig.

Getting up and running

Styleguide

The styleguide is integrated into the twig-theme. It is a static site generated by Spress.

You can view the styleguide in two ways:-

  1. Setup a dev domain to point at the /twig-theme/styleguide/build folder

  2. Install Spress and run Spress local server

    • Follow the getting started page on the Spress.
    • Using the command line cd into that directory and run ./watch.sh, this will start Spress's built in server and serve the site from http://localhost:4000

Notes on symlinks

The partials directory in twig-theme/styleguide/src/includes contains all the twig templates shared by twig-theme and the styleguide. Unfortunately I could not get symlinked folders to work inside the styleguide so I've had to place the files within the styleguide and symlink them out to the main folder of twig-them.

It would be better if there was a way in Spress to specify other directories outside of the Spress folder to look in when generating the static site.

I think this might not be too hard to do so I plan on giving it a go an submitting it patch to Spress if I manage it.

Twig cartoon character wearing a cape