主题开发文档

更新您的主题

💡 云策文档标注

概述

本文档介绍了更新WordPress主题的两种方法:上传Zip文件和使用Subversion(SVN)。针对主题在队列中等待审核或已在仓库中的情况,提供了详细的操作指南和注意事项。

关键要点

  • 更新主题可通过上传Zip文件或使用SVN两种方式实现。
  • 上传Zip文件时,需确保在style.css中更新版本号,但不会影响队列位置。
  • SVN更新适用于Mac和Windows用户,需使用GUI客户端如TortoiseSVN或SmartSVN。
  • 重要注意事项包括:目录命名需包含新版本号、版本号必须遵循标准命名约定且高于当前版本、SVN不是开发工具,提交后无法修改。
  • MacOS上使用SVN更新主题的步骤包括:检出仓库、创建新目录并复制文件、修改主题、移除隐藏文件、提交更改。

注意事项

  • 提交SVN后无法撤销或修改,如有错误需创建新版本目录重新上传。
  • 更新后需等待WordPress.org目录同步,并会收到确认邮件。

📄 原文内容

There are two ways to update your theme, by uploading a Zip file or using subversion (SVN).

Uploading a Zip file

While your theme is in the queue and waiting for review, you can update your theme by uploading a Zip file. Just as you initially uploaded. Be sure to update the version number on style.css before uploading.

Updating the version number will NOT change the queue position of your theme while waiting for the review.

If you already have your themes in the repository, you can either update by uploading a Zip file or via SVN.

Subversion GUI clients

Several GUI clients are available for Windows users. TortoiseSVN is one of the popular Free clients. SmartSVN is a paid application that works on Windows, Linux, and macOS.

For Mac users, SVN helps streamline the automation process, including removing <em>.DS_Store</em> and <em>__MACOSX</em> hidden files and folders that often trigger the theme check errors.

Important notes:

(1) Directory naming guidelines

The theme author must create a new directory before uploading the theme. It is important to name the new directory with the new version number. For example, if the current theme is version <em>1.0.1</em>, the name for the new directory must be 1.0.2.

(2) Version numbering

Version numbering must follow a standard version naming convention. New version must be higher than the current version. For example, if your current theme is <em>1.2.3</em>, the new version must be <em>1.2.4</em>.

(3) SVN is not a development tool

Unlike Github, SVN is not a development tool. You should upload your theme only when you are ready to release a new version. Once you commit, the changes cannot be overwritten. If you find a mistake, even a small typo, there is no way to make changes. The only way to make corrections is to create another directory with a newer version number and upload it again.

Uploading your themes using SVN on MacOS

What you will need

  • MacOS
  • VS code
  • SVN extension for VS code

To check whether you have svn installed, type svn --version in the terminal.

(1) Create a copy of the repository on your local machine. Replace /NameOfYourTheme/ with your theme name. <em>svn co https://themes.svn.wordpress.org/NameOfYourTheme/</em>

For example, if your theme name is Hello World,
use <em>svn co https://themes.svn.wordpress.org/hello-world/</em>

Tips: If you are not sure about the exact name of your theme (e.g. hyphen, underscore), you can find it at this link.

(2) The next step is to create a new directory and copy all theme files, including the history from the current version of the theme. In the example below, we are creating a new directory 1.0.2, and copying all files from the version 1.0.1. <em>svn cp 1.0.1 1.0.2</em>

(3) Make changes to your theme.

Note: Make sure to update the version number on style.css, and the changelog on readme.txt

(4) Remove .DS_Store hidden file. <em>find . -name ".DS_Store" -print -delete</em>

(5) Next, remove <em>__MACOSX</em> folder. <em>rm -R __MACOSX</em>

(6) Finally, you are ready to commit.

<em>svn commit -m “Fix typo on readme.txt”</em>

Note: Once you commit, there is no way to change or modify what you just committed. If you find a mistake, Repeat the process from step 2.

What to expect next

Once you successfully upload the new update, you will receive a confirmation email from WordPress.org. It may take some time to reflect on the WordPress.org directory.