Timber

Timber

توسط

With the upcoming release of Timber 2.0, we will not release a 2.0 version and beyond as a plugin, but only as a Composer package. We advise everyone to switch to the Composer based install as soon as possible.
You will find an extensive list with guides and the reasons why we are not going to release Timber 2.0 as a plugin anymore.

Switching to the Composer based version

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.

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.

Want to learn more?

Looking for Documentation?

Need support?

Support

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

  1. Activate the plugin through the ‘Plugins’ menu in WordPress
  2. For an example, try modifying your home.php or index.php with something like this:

    $context = array();
    $context[‘message’] = ‘Hello Timber!’;
    Timber::render( ‘welcome.twig’, $context );

Then create a subdirectory called views in your theme folder. Then create a file views/welcome.twig with these contents:

<div class="welcome">
    <h3>{{ message }}</h3>
</div>

When you visit this page, you’ll see both the data from PHP come through as you’ve marked it up. For more, continue with the official Getting Started Guide

سوالات متداول

Can it be used in an existing theme?

You bet! Watch these Video Tutorials to see how.

Is it used in production?

Tens of thousands of sites now use Timber. You can check some of them out in the Showcase.

Doesn’t this all make WordPress harder since there’s more to learn?

Does jQuery make JavaScript harder? Yes, it’s an extra piece to learn — but it super-charges your ability to write unencumbered JavaScript (and prevents you from having to learn lots of the messy internals). If your answer is “jQuery sucks and everyone should learn how to write vanilla JavaScript or they’re rotten stupid people,” this tool isn’t for you.

Oh, Timber is simple code so it’s for making simple themes

Whatever. It simplifies the silly stuff so that you can focus on building more complicated sites and apps. jQuery simplifies Javascript, but you can still use the full range of JavaScript’s abilities.

Will you support it?

At Upstatement we’re using it in dozens of sites (and many more planned) — thousands of other developers are using it too. This isn’t going anywhere. Twig is the chosen language for other PHP platforms like Symfony, Drupal 8 and Craft.

×
نظری برای این آیتم موجود نیست.
0 0 رای ها
امتیازدهی
اشتراک در
اطلاع از
0 نظرات
قدیمی‌ترین
تازه‌ترین بیشترین رأی
هیچ نسخه‌ای برای این آیتم موجود نیست.
★★★★★
★★★★★
4.9 /5 (71 نظر)

قیمت:

رایگان

نگارش

آخرین انتشار

10 اردیبهشت 1405

آخرین بروزرسانی

4 ماه پیش

نصب های فعال

20,000+

نگارش وردپرس

وردپرس 5.3.0+

تست شده از نسخه

وردپرس 6.8.5

نگارش PHP

PHP 7.2.5+

نسخه ها

0 نسخه