主题开发文档

💡 云策文档标注

概述

本章涵盖WordPress主题开发中的高级功能和技术,包括国际化、子主题、构建流程等,适合计划分发主题的开发者。

关键要点

  • 国际化:确保主题可翻译为任何语言的技术和技巧
  • 子主题:通过扩展父主题构建自定义主题,减少工作量
  • 构建流程:集成@wordpress/scripts包处理和打包主题资源
  • 隐私:测试WordPress内置隐私功能并确保主题兼容
  • 测试:使用测试工具套件确保主题在各种环境中正常工作
  • 调试:启用WordPress调试功能以确保主题无错误
  • 安全:主题应遵循的安全最佳实践以防御漏洞
  • 发布主题:在WordPress.org发布或分发主题的步骤

注意事项

  • 本章内容虽为“高级”,但初学者也可学习,特别是计划分发主题时
  • 部分文档(如Plugin API Hooks、UI Best Practices、JavaScript Best Practices)正在更新中,未来可能移至更合适的章节

📄 原文内容

Welcome to the advanced theme topics documentation. In this chapter, you will learn about some of the more complex features, techniques, and more that are not covered in previous chapters.

While this chapter is considered “advanced” it doesn’t mean you cannot learn something if you’re still getting started on your theme development journey. In many ways, the articles in this chapter are essential if you plan to distribute your theme to others, such as through the WordPress Theme Directory.

Navigating this chapter

Use the following links to locate a topic within this chapter. Each article covers a specific topic that is relevant to theme development, and you can explore each at your own pace.

  • Internationalization: Must-know techniques and tips to ensure your theme can be translated into any language.
  • Child Themes: Build a custom theme that extends an existing theme (i.e., parent theme) and requires less work.
  • Build Process: How to integrate with the @wordpress/scripts package to process and bundle your theme assets.
  • Privacy: Test the built-in WordPress privacy features and ensure your theme works with them.
  • Testing: How to run your theme through a suite of testing tools to make sure it works across a variety of environments.
  • Debugging: How to enable debugging in WordPress to ensure your theme is error free.
  • Security: A rundown of security best practices that your theme should be doing to defend against exploits.
  • Publishing Themes: The steps you need to take to publish your theme on WordPress.org or distribute to others.

This chapter also includes several other documents that are currently undergoing updates. These will eventually be updated or moved to more appropriate chapters: