Presenting a faster, easier and more powerful way to build themes. Because WordPress is awesome, but the loop isn't.

Overview

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 your PHP file can focus on supplying the data and logic, while your twig file can focus 100% on the display and HTML.

Who is this for?

Timber is for both WordPress pros and rookies. People new to WordPress will like how it reduces the WordPress-specific knowledge required to theme a website. While pros can take advantage of object-oriented patterns that adhere to DRY and MVC principles.

What does the code look like?

With Timber you manage your theme in PHP and Twig (HTML) files. This separates the logic (getting stuff from WordPress) from presentation (adding tags, classes, etc.) — just like Rails, Django, Node and other platforms.

single.php
						
						$context = Timber::get_context();
						$context['foo'] = 'Bar!';
						$context['post'] = new TimberPost();
						Timber::render('single.twig', $context);
						
					
single.twig
						
							{% extends "base.twig" %}
							{% block content %}
							<h1 class="big-title">{{foo}}</h1>
							<h2>{{post.title}}</h2>
<img src="{{post.thumbnail.src}}" />
<div class="body">
     {{post.content}}
</div> {% endblock %}

What does it look like?

Timber doesn't change the visual appearance of your theme. Installing Timber is like installing jQuery — it just gives you new tools to build and style it as you like.

Object Oriented Posts, Terms, Users and More

Speak to the common WordPress objects in a way that makes sense. Have you ever tried to get the thumbnail of a post?

The old way

					$thumb_id = get_post_thumbnail_id($post->ID);
					$url = wp_get_attachment_url($thumb_id);
					<img src="<?php echo $url; ?>" alt="Thumbnail for <?php echo $post->post_title; ?>" />
				

Yuck! Maybe you can remember all those functions, but I sure can't. If you're a pro WordPress dev you probably have a mess of shortcut functions to help you with a common task. But here's the rub: YOUR shortcuts are going to be different than everyone else's.

The Timber way

										<img src="{{post.thumbnail.src}}" alt="Thumbnail for Timber" />
				

It's a Library, not a Framework

Timber works with your existing themes to unlock new power. You don't have to throw out everything you already have working.

The best tools evolve into your workflow: I didn't know I wanted to use jQuery or SASS until I started using them. Bit-by-bit they replaced the 'old' ways of doing things until I couldn't imagine life without them. Timber lets you start with just a bit. Say you want to just include an HTML snippet with a variable from your database:

home.php

					$data['welcome_message'] = get_option('welcome_message');
					Timber::render('welcome.twig', $data);
				
Inside your twig file:

					{# welcome.twig #}
					<p class="intro">{{welcome_message}}</p>
				

Timber is a free open-source project for everyone who uses WordPress.
The best payment is to Tweet and star the project on GitHub so others can find it and contribute.

Showcase

Built By