Patterns 是 WordPress 主题开发中用于复用块组的强大工具,适用于多种场景,如提供可插入布局和运行 PHP 代码。本章介绍 Patterns 的基础概念、注册方法、PHP 使用、模板集成、块类型 Patterns、起始 Patterns 和块锁定功能。
Patterns are one of the most useful tools for theme development, allowing you to reuse groups of blocks across a wide variety of scenarios. Over time, you will likely use patterns more than any other theme feature available in WordPress.
In this chapter, you will learn what patterns are and dive into the various use cases where you will apply them in your themes. This will include everything from providing insertable layouts to your theme users to running PHP for loading assets and even more.
Use the following links to locate a specific topic within this chapter. It’s best to read them in order, but if you are already familiar with the basic tenets of pattern development, feel free to jump to the topic that you’re looking for.