跳转到主要内容

Global Settings and Styles (theme.json)

Welcome to the Global Settings and Styles documentation. In this chapter you will learn everything you need to know about configuring settings, styles, and more via your theme’s theme.json file.

theme.json is a foundational piece of block theming. While it is not a strictly required file, you will need to work with it for nearly any theme project. It is useful for everything from configuring colors to defining default typography settings to applying front-end styles to your theme.

Navigating this chapter

  • Introduction to theme.json: A walkthrough of setting up your theme.json file, introducing you to the foundational concepts for configuring global settings and styles for your theme.
  • Settings: Documentation for each of the standard and custom settings that you can configure via theme.json. Sub-pages document every available setting.
  • Styles: Learn how to use the standard design system to apply styles through theme.json, which also integrate with the user interface.
  • Custom Templates: How to register custom post, page, and CPT (custom post type) templates for your theme.
  • Template Parts: How to register custom template parts that can be reused across your theme.
  • Patterns: How to bundle patterns from the official patterns repository with your theme.
  • Style Variations: Documentation on creating custom theme.json style variations, giving your users alternative designs to choose from.