跳转到主要内容

书籍

Timber 主题开发文档

Timber v2 主题开发文档,介绍 Twig 模板与 WordPress 集成。

46 页更新于 2 个月前

开始阅读

目录46

  1. 01 Timber v2.x What is Timber? Timber helps you create fully-customized WordPress themes faster with more sustainable code... 2 个月前
  2. 02 A post archive Here’s how a PHP template file for a WordPress archive looks like. index.php $context = Timber::context(); ... 2 个月前
  3. 03 A single post Let’s look at a singular post template in more detail, because echoing a post’s title with {{ post.title }... 2 个月前
  4. 04 Introduction Let’s get familiar with some of the concepts of Timber and Twig. Tutorial theme If you want to start from s... 2 个月前
  5. 05 Template inheritance and includes Template inheritance You might have realized that there’s no HTML skeleton around the HTML for a post yet. ... 2 个月前
  6. 06 Cheatsheet Here are some helpful conversions for functions you’re probably well familiar with in WordPress and their T... 2 个月前
  7. 07 Class Maps The Class Map is the central hub for Timber to select the right PHP class for post or term objects. Wheneve... 2 个月前
  8. 08 Comments Simple Comment Implementation Looking to do non-threaded comments? This pattern can be expanded upon. If yo... 2 个月前
  9. 09 Context The context is one of the most important concepts to understand in Timber. Think of the context as the set ... 2 个月前
  10. 10 Image Cookbook Timber makes it damn easy to use an image in a tag. Automatically, Timber will interpret images attached to... 2 个月前
  11. 11 Text Cookbook There’s tons of stuff you can do with Twig and Timber filters to make complex transformations easy (and fun... 2 个月前
  12. 12 Custom Fields Timber tries to make it as easy as possible for you to retrieve custom meta data for Post, Term, User and C... 2 个月前
  13. 13 Custom Integrations The new Integrations API (available from Timber 2.0) provides a generalized way to integrate with third-par... 2 个月前
  14. 14 Custom Page Templates Imagine that you’ve created a page called «About Us» and WordPress has given it the slug about-us. How wou... 2 个月前
  15. 15 Date/Time in Timber Working with dates and times in WordPress Before we tell you how to work with dates and times in Timber, we... 2 个月前
  16. 16 Debugging Enable debugging To use debugging, the constant WP_DEBUG needs to be set to true. wp-config.php define('W... 2 个月前
  17. 17 Escaping Escaping describes the practice of securing output before rendering it for the end user of your website. Da... 2 个月前
  18. 18 Extending Timber There’s a myth that Timber is for making simple themes, but in fact it’s for making incredibly complex them... 2 个月前
  19. 19 Extending Twig Twig Environment Twig has a \Twig\Environment class that you can use to extend Twig. One of the most commo... 2 个月前
  20. 20 Functions Timber makes it easy to work with PHP functions in your Twig templates. You have three options: Use built-i... 2 个月前
  21. 21 Block Editor (Gutenberg) Using the Block Editor with Timber Timber works with the Block Editor (also called Gutenberg) out of the bo... 2 个月前
  22. 22 Hosts & Servers This guide serves as reference for any host or server-specific information we gather. If you have experienc... 2 个月前
  23. 23 Internationalization Internationalization of a Timber theme works pretty much the same way as it does for default WordPress them... 2 个月前
  24. 24 Menus In Timber, we handle menus a little differently than in WordPress. We’d say it’s a little smoother and more... 2 个月前
  25. 25 Pagination There are three types of pagination, which all work differently, but can easily be confused with each other... 2 个月前
  26. 26 Performance/Caching Timber, especially in conjunction with WordPress and Twig, offers a variety of caching strategies to optimi... 2 个月前
  27. 27 Posts To get a post object in Timber, you use Timber::get_post() and pass the WordPress post ID as an argument. ... 2 个月前
  28. 28 Routing Timber 1.x shipped with the Upstatement/routes package for custom routes (see Routing Guide for Timber v1).... 2 个月前
  29. 29 Shortcodes Let’s implement a [youtube] shortcode which embeds a youtube video. For the desired usage of [youtube id=... 2 个月前
  30. 30 Sidebars So you want a sidebar? Method 1: PHP file Let's say every page on the site has the same content going into ... 2 个月前
  31. 31 Template Locations Timber::render('teaser.twig'); When you use Timber::render(), Timber::compile(), or Twig includes to rend... 2 个月前
  32. 32 Terms Get a term To get a term object in Timber, you use Timber::get_term() and pass the WordPress term ID as an... 2 个月前
  33. 33 Automated Testing Setup a testing environment with PHPUnit Follow the setup steps for Varying Vagrant Vagrants. If you’re hav... 2 个月前
  34. 34 Twig Blocks Timber provides powerful functionality for rendering specific blocks from Twig templates, both from PHP and... 2 个月前
  35. 35 Twig filters General Filters Twig offers a variety of filters to transform text and other information into the desired o... 2 个月前
  36. 36 Twig With Timber, you can use all the features that Twig has to offer, plus some more. In this guide, we repeat ... 2 个月前
  37. 37 Users To get a user object in Timber, you use Timber::get_user() and pass the WordPress user ID as an argument. ... 2 个月前
  38. 38 Widgets In a world where the block editor is used more and more, widgets are getting less important. However, they ... 2 个月前
  39. 39 WooCommerce Point of entry - main WooCommerce PHP file The first step to get your WooCommerce project integrated with T... 2 个月前
  40. 40 0040-guides-wp-cli title: "WP-CLI" order: "1670" Timber includes its own wp timber command for WP-CLI, the WordPress Command ... 2 个月前
  41. 41 Installation You can install Timber through Composer. If you’re not familiar with Composer yet, read our short introduct... 2 个月前
  42. 42 0042-installation-intro-to-composer title: "A short intro to Composer" hideInMenu: true order: "20" If you’re familiar with the WordPress plugi... 2 个月前
  43. 43 0043-installation-manage-timber-with-composer title: "Managing Timber with Composer" order: "30" The following guide should help you manage the installed... 2 个月前
  44. 44 Advanced Custom Fields Timber is designed to play nicely with the amazing Advanced Custom Fields plugin. Getting data from ACF If ... 2 个月前
  45. 45 Upgrade to 1.0 A significant part of this 1.0 release is removing lots of deprecated functions and methods that go back to... 2 个月前
  46. 46 Upgrade to 2.0 Version 2.0 of Timber Will only work as a Composer package. Tries to make the naming of functions and filte... 2 个月前