本文档介绍了更新WordPress主题的两种方法:上传Zip文件和使用Subversion(SVN)。针对主题在队列中等待审核或已在仓库中的情况,提供了详细的操作指南和注意事项。
There are two ways to update your theme, by uploading a Zip file or using subversion (SVN).
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.
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.
(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.
What you will need
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.
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.