主题开发文档

主题开发手册

💡 云策文档标注

概述

本文档是WordPress主题开发的综合指南,面向从新手到经验丰富的开发者,涵盖块主题和经典主题的构建方法。它提供了从基础概念到高级主题的全面学习路径,帮助开发者理解主题类型差异并选择适合的开发方向。

关键要点

  • 手册包含块主题和经典主题的构建指导:块主题基于HTML和配置文件,适用于WordPress 5.9及以上版本,完全由块组成;经典主题使用PHP、JavaScript和CSS,无版本限制。
  • 学习路径建议从基础部分开始,包括主题定义、WordPress许可证和开发环境设置,然后进入核心概念和高级主题(如子主题、UI最佳实践和测试)。
  • 手册由WordPress社区创建和维护,鼓励贡献者参与,以持续更新和完善内容。

📄 原文内容

Welcome to the WordPress Theme Developer Handbook, your resource for learning all about the exciting world of WordPress themes. 

The Theme Developer Handbook is a repository for all things WordPress themes. Whether you’re new to WordPress themes, or you’re an experienced theme developer, you should be able to find the answer to many of your theme-related questions right here.

In this handbook, you can learn how to build block themes or classic themes.

  • A block theme is a new theme that you can use from WordPress version 5.9. It is built mainly using HTML and a theme configuration file. The block theme is composed entirely of blocks, allowing you to edit all parts of your site in the Site Editor.
  • A classic theme is the original theme, without version limitations, that primarily uses PHP, JavaScript and CSS. Classic themes take advantage of WordPress PHP functions, hooks and filters.
  1. If you’re new to developing WordPress themes, start with section 1, where you can find out what a theme is, learn about WordPress’ license, and set up your development environment.
  2. Once you’re through the introduction, continue with the Core Concepts section.

It is recommended to read through both the block theme section and the classic theme sections. This will give you an understanding of the differences between the two types of themes, and help you choose what type of theme to build.

If you’ve got to grips with the basics of themes, check out the Advanced Theme Topics to learn about child themes, best UI practices, theme testing and more.

Once you’ve got your theme ready for the world, the final section will cover releasing your theme, teaching you some best practices for theme distribution, and for getting it ready for the WordPress.org theme directory.


The WordPress Theme Developer Handbook is created by the WordPress community, for the WordPress community. We are always looking for more contributors; if you’re interested stop by the docs team blog to find out more about getting involved.