Timber helps you create fully-customized WordPress themes faster with more sustainable code. With Timber, you write your HTML using the Twig Template Engine separate from your PHP files.
This cleans-up your theme code so, for example, your php file can focus on being the data/logic, while your twig file can focus 100% on the HTML and display.
This is what Timber's .twig
files look like:
{% extends "base.twig" %}
{% block content %}
<h1 class="big-title">{{foo}}</h1>
<h2 class="post-title">{{post.title}}</h2>
<img src="{{post.thumbnail.src}}" />
<div class="body">
{{post.content}}
</div>
{% endblock %}
Once Timber is installed and activated in your plugin directory, it gives any WordPress theme the ability to take advantage of the power of Twig and other Timber features.
NEW! The GitHub version of Timber now requires Composer. If you'd prefer one-click installation, you should use the WordPress.org version.
cd ~/MYSITE/wp-content/plugins
git clone [email protected]:jarednova/timber.git
cd timber
composer install
Once this is complete, activate Timber your WordPress admin. If you're looking for a 'blank' theme to start developing with, drag the timber-starter-theme
from the timber directory into your themes directory.
Timber is a tool for developers who want to translate their HTML into high-quality WordPress themes through an intuitive, consistent and fully-accessible interface.
- Intuitive: The API is written to be user-centric around a programmer's expectations.
- Consistent: All WordPress objects can be accessed through polymorphic properties like slug, ID and name.
- Accessible: No black boxes. Every effort is made so the developer has access to 100% of their HTML.
Nothing. Timber is meant for you to build a theme on. Like the Starkers or Boilerplate theme it comes style-free, because you're the style expert. Instead, Timber handles the logic you need to make a kick-ass looking site.
Timber is great for any WordPress developer who cares about writing good, maintainable code. It helps teams of designers and developers working together. At Upstatement we made Timber because while our entire team needs to participate in building WordPress sites, not everyone knows the ins-and-outs of the_loop(), codex and PHP (nor should they). With Timber your best WordPress dev can focus on building the .php files with requests from WordPress and pass the data into .twig files. Once there, designers can easily mark-up data and build out a site's look-and-feel.
- Timber Debug Bar Adds a debug bar panel that will show you want template is in-use and the data sent to your twig file.
- TimberPhoton Plug-in to use JetPack's free Photon image manipulation and CDN with Timber.
- Timber Sugar A catch-all for goodies to use w Timber.
- Twig The template language used by Timber.
It's GPL-licensed, so please use in personal or commercial work. Just don't re-sell it. While Timber is still in development, it's also in-use on hundreds of sites. While much has been stabilized since the first major push back in June 2013, you should expect some breaking changes as development progresses towards a version 1.0.
Read the contributor guidelines in the wiki.