GithubHelp home page GithubHelp logo

joshrickert / timber Goto Github PK

View Code? Open in Web Editor NEW

This project forked from timber/timber

0.0 2.0 0.0 18.99 MB

Plugin to write WordPress themes w object-oriented code and the Twig Template Engine

Home Page: https://timber.github.io/docs/

License: MIT License

Shell 0.79% PHP 98.56% HTML 0.57% CSS 0.07%

timber's Introduction

By Jared Novack (@jarednova), Lukas Gächter (@lgaechter), Pascal Knecht (@pascalknecht), Maciej Palmowski (@palmiak_fp), Coby Tamayo (@cobytamayo), Upstatement and hundreds of other GitHub contributors

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version WordPress Download Count Join the chat at https://gitter.im/timber/timber WordPress Rating

Because WordPress is awesome, but the_loop isn't

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 (from this Hello World example)

{% 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 plugins directory, it gives any WordPress theme the ability to take advantage of the power of Twig and other Timber features.

Looking for docs?


Installation

The GitHub version of Timber requires Composer and is setup for inclusion within a theme or plugin. If you'd prefer one-click installation for your site, you should use the WordPress.org version.

cd ~/wp-content/themes/my-theme
composer require timber/timber

If your theme/plugin is not setup to pull in Composer's autoload file, you will need to

/* functions.php */
require_once(__DIR__ . '/vendor/autoload.php');

After this line, initialize Timber with

$timber = new \Timber\Timber();

What Now?

Setup the Timber Starter Theme. Once you have that installed in your WordPress setup, continue reading the Getting Started guide to Themeing.


Mission Statement

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: WordPress objects can be accessed through common 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.

What does it look like?

Nothing. Timber is meant for you to build a theme on. Like _s it comes style-free, because you're the style expert. Instead, Timber handles the logic you need to make a kick-ass looking site.

Who is it good for?

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 engineer 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.

Related & Official Projects

  • Twig The template language used by Timber.
  • Timber Starter Theme The "_s" of Timber to give you an easy start to the most basic theme you can build upon and customize.
  • Timber Debug Bar Adds a debug bar panel that will show you which template is in-use and the data sent to your twig file.

Related Timber Projects

  • Pine A CLI installer for Timber
  • Timber CLI A CLI for Timber
  • Timber Commented Include Debug output via HTML comments before and after each include statement in Twig
  • Timber Debugger Package that provides extra debugging options for Timber
  • Timber Dump Extension Debug output with nice formatting
  • Timber Photon 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
  • Timber WebLink Extension Provides Twig functions to manage the Link HTTP header needed for Web Linking when using HTTP/2 Server Push as well as Resource Hints
  • Timmy Advanced image manipulation for Timber

Projects that use Timber

  • Gantry5 a framework for theme development
  • Branch Bootstrap + Timber = Branch starter theme!

Helpful Links

Support

Please post on StackOverflow under the "Timber" tag. Please use GitHub issues only for specific bugs, feature requests and other types of issues.

Should I use it?

It's MIT-licensed, so please use in personal or commercial work. Just don't re-sell it. Timber is used on tens of thousands of sites (and tons more we don't know about)

Contributing

We love PRs! Read the Contributor Guidelines.

Documentation

The Official Documentation for Timber is generated from the contents of this repository:

timber's People

Contributors

jarednova avatar gchtr avatar lggorman avatar alexsomeoddpilot avatar hsz avatar scrutinizer-auto-fixer avatar xavivars avatar palmiak avatar maxxwv avatar xavierpriour avatar amoniker avatar jnweaver avatar pascalknecht avatar marciojc avatar motia avatar parisholley avatar mmikkel avatar tnottu avatar flyingdr avatar nlemoine avatar slimndap avatar salaros avatar aaemnnosttv avatar matgargano avatar mswartz avatar aduth avatar heino avatar nickbarrettjb avatar pkarl avatar josephbergdoll avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.