A barebones Timber WordPress theme that uses Twig templating.
HTML PHP CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
templates
views
.gitignore
404.php
README.md
footer.php
functions.php
header.php
index.php
screenshot.png
single.php
style.css

README.md

Alt text

Fuji WordPress Theme

A barebones Timber WordPress theme that uses Twig templating.

How to use

Installation

This theme was built to be used with the Fuji Front-end Boilerplate. Once you've set it up, simply clone this theme down into /public/wp-content/themes.

Important: Since this theme uses Twig for its templating, you'll need to install the Timber plugin, before you activate the theme in the CMS.

Add a template

By default, this theme comes with a single basic template. To add more templates is dead simple!

  • First, you'll need to create a view for it by creating a file called: {your-template-name}.twig, in /views.
  • Inside the file, you'll want to extend layout.twig (<head> and <body>) and put in a content block. It should look something like this:
{# foobar.twig #}

{% extends "layout.twig" %}

{% block content %}

  {# Your markup goes here. #}

{% endblock %}
  • In the /templates folder, create a file: page-{your-template-name}.php. You'll want to match it to the view you just created:
// page-foobar.php

<?php
  /* Template Name: Foobar Template */
  create_template('foobar');

create_template refers to a function in functions.php, which is used to set up a basic template, which renders a view and grabs the page's context:

// functions.php

function create_template($view) {
  $context = Timber::get_context();
  $context['post'] = new TimberPost();
  Timber::render($view.'.twig', $context);
}

You will need to modify or the template file if you want to add more to the page's context.

Further reading

This WordPress theme relies on Timber and Twig syntax, and it was inspired by Timber's default theme. Please read more here: