jarednova/timber
Composer 安装命令:
composer require jarednova/timber
包简介
Create WordPress themes with beautiful OOP code and the Twig Template Engine
README 文档
README
Timber 2.0
By Jared Novack (@jarednova), Lukas Gächter (@lgaechter), Nicolas Lemoine (@nlemoine), Erik van der Bas (website), Coby Tamayo (@cobytamayo), Upstatement and hundreds of other GitHub contributors:
⚠️ Important information about the Timber plugin ⚠️
With the release of Timber 2.0, Composer is the only supported install method. We are unable to continue releasing or supporting Timber as a plugin on WordPress.org. We advise everyone to switch to the Composer based install of Timber 1 as a first step as soon as possible. If you need PHP 8.2 support you will have to switch to Timber 2.0.
For more information and a list of additional resources, please visit this discussion.
What is Timber?
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, it gives any WordPress theme the ability to take advantage of the power of Twig and other Timber features.
Documentation
Installation
Follow the Installation Guide for how to install Timber using Composer.
What Now?
Setup the Timber Starter Theme. Once you have that installed in your WordPress setup, continue reading the Getting Started guide to Theming.
Timber’s mission
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 underscores 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.
Should I use it?
Timber is 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)
Timber 1
You can find the code for Timber 1 on the 1.x branch and read the Timber 1 documentation over here.
Links
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.
- wp-i18n-twig WP CLI Command to grab translatable strings from Twig files.
- 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
- Editor for Timber Edit your Twig files from the WordPress admin
- Pine A CLI installer for Timber
- Query Monitor Twig Profile An add-on for Query Monitor to see what's going on inside your Twig files (automatically works with Timber!)
- Timber ACF WP Blocks Easy ACF Gutenberg blocks creation
- 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 VS Code Extension Snippets for Timber in Visual Studio Code
- 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
- Branch Bootstrap 3 + Timber = Branch starter theme!
- Flynt a component based WordPress starter theme built on Timber and ACF Pro
- Gantry5 a framework for theme development
- Hozokit a component based starter theme
- Juniper Starter pack that incorporates Timber and Bedrock
- Seedling a starter theme using Bootstrap 4
Helpful Links
- CSS Tricks introduction to Timber by @tjFogarty
- Twig for Timber Cheatsheet by @laras126
- Timber Cheatsheet by @taotiwordpress
- TutsPlus A guide to getting started by @ahmadawais
Reporting Security Issues
To disclose a security issue to our team, please submit a report via GitHub.
Support
Please post on StackOverflow under the "Timber" tag. Please use GitHub issues only for specific bugs, feature requests and other types of issues.
Contributing & Community
We love PRs! Read the Contributor Guidelines for more info. Say hello, share your tips/work, and spread the love on Twitter at @TimberWP.
Sponsor us
Since 2013 our goal at Timber is to create a library to that helps you create fully-customized WordPress themes faster with more sustainable code.
Through the collaborative efforts of both our dedicated team and countless contributors, we have invested numerous hours in maintaining and enhancing Timber. To keep doing that, we rely on the invaluable support of our sponsors.
Are you a WordPress pro or part of an agency who relies on Timber? Keep the magic alive by becoming a sponsor! By becoming a sponsor, you contribute to the continuous maintenance and enhancement of Timber, ultimately benefiting developers worldwide.
Gold Sponsors
Our backers
Documentation
The Official Documentation for Timber is generated from the contents of this repository:
- Documentation for classes and functions is auto generated. Any changes to the Reference section of the docs should be made by editing the function’s DocBlock. For inline documentation, we follow the WordPress PHP Documentation Standards.
- To make a change to one of the guides, edit the relevant file in the
docsdirectory.
jarednova/timber 适用场景与选型建议
jarednova/timber 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 67.53k 次下载、GitHub Stars 达 5.65k, 最近一次更新时间为 2013 年 11 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「templating」 「twig」 「themes」 「wordpress」 「timber」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jarednova/timber 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jarednova/timber 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jarednova/timber 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Laravel Themes
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
A Twig extension to insert css as inline styles with a tag
WordPress mu-plugin to register the theme directory for the default WordPress themes.
This is twig version of Flow Theme for OXID eShop.
统计信息
- 总下载量: 67.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5656
- 点击次数: 21
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-11-02