WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Using Themes

介绍

WordPress 是一套具备快速,轻量,并容易开发特点的开源程序. 为了保持这样的特性, 开发团队 会将需要的新功能谨慎的添加到 WordPress 中去. 不过,用户通常会需要将额外的功能添加到 WordPress 中来满足他们的需求. 这个开发文档为任何希望修改,扩展或贡献 WordPress 的开发者提供指南和参考.


你可以在此查阅开发过程中遇到的的常见问题 开发文档 FQA

注意: 文档阅读前提
以下开发文档将可以使用编程相关的术语,而不提供对非程序员用户的详细解释.

尽管 WordPress 可下载文件的调整权限仅掌握在几个不同的程序员手中,但每个 WordPress 用户都能够修改 WordPress 的核心代码,从而使得 WordPress实现高度定制化服务.

Plugin Development

  • Plugin Developer Handbook - The best starting place for learning about how to develop plugins
  • WordPress Coding Standards - General information about coding standards for WordPress development
  • Debugging in WordPress - Reference and guide for using the built-in debugging system in WordPress.
  • Data Validation - A must-read for WordPress plugin authors. Describes the functions used by WordPress to validate and sanitize data. Plugin authors should be familiar with these functions and ideas.
  • Plugin Submission and Promotion - Once you have written your plugin, here are some hints on distributing it widely
  • Migrating Plugins and Themes - Contains information on how to upgrade your Plugin so it will work from version to version of WordPress
  • Function Reference - Complete PHP function reference for WordPress
  • Global Variables - A list of all global variables created by WordPress
  • Post Types - Creating new types of posts other than the posts that display on the main loop.
  • Taxonomies - Creating new types of taxonomies other than the built-in ones.
  • Reserved Terms - A list of reserved terms in WordPress.

APIs

  • Plugin API - Hooks, Actions, and Filters to use in your Plugins (version 2.1; has links to older version articles)
  • Shortcode API - A tutorial and reference for the shortcode API (new in version 2.5)
  • Dashboard Widgets API - A reference with examples for adding new widgets to the admin dashboard.
  • Settings API - A reference with examples for adding new settings to existing settings screens.
  • Options API - Details about the generic option storage system.
  • Transients API - Details about the temporary/time-constrained data storage system.
  • Widgets API - A reference with examples for creating widgets for use in sidebars.
  • Quicktags API - A reference for adding buttons to the HTML editor.
  • Rewrite API - Details about the URL rewriting API.
  • Theme Customization API - Details about the API for Theme Customization screen.
  • Filesystem API - Reference for reading and writing local files to the filesystem to be done securely, on a variety of host types.

Contributing to WordPress

  • Contributing to WordPress - Main starting point if you would like to contribute to core WordPress development, documentation, support, translations, or financial health
  • Automated Testing - Testing WordPress using the automated test suite and how to use the tools and write test cases.
  • Release Philosophy - The philosophy of WordPress releases.

Forums, Lists, and Blogs

Other Information of Interest

  • Advanced Topics - Annotated list of many articles on advanced WordPress topics
  • Query Overview - Description of the WordPress query process used to find posts and display them
  • Reporting Bugs - Information on reporting and fixing WordPress bugs
  • Using Subversion - Introduction to SVN, the source code repository used by WordPress
  • Development Team - The members of the development team.

Other Resources

About WordPressGetting Started with WordPressWorking with WordPressBlog Design and LayoutAdvanced TopicsTroubleshootingDeveloper DocumentationCurrent Events
中文(繁體)
(Add your language)

</p>

What is a Theme?

Fundamentally, the WordPress Theme system is a way to "skin" your weblog. Yet, it is more than just a "skin." Skinning your site implies that only the design is changed. WordPress Themes can provide much more control over the look and presentation of the material on your website.

A WordPress Theme is a collection of files that work together to produce a graphical interface with an underlying unifying design for a weblog. These files are called template files. A Theme modifies the way the site is displayed, without modifying the underlying software. Themes may include customized template files, image files (*.jpg, *.gif), style sheets (*.css), custom Pages, as well as any necessary code files (*.php). For an introduction to template files, see Stepping Into Templates.

Let's say you write a lot about cheese and gadgets. Through the use of the WordPress Loop and template files, you can customize your Cheese category posts to look different from your Gadgets category posts. With this powerful control over what different pages and categories look like on your site, you are limited only by your imagination. For information on how to use different Themes for different categories or posts, see The Loop in Action and Category Templates.

Get New Themes

The WordPress Theme Directory is the official site for WordPress Themes which have been checked and inspected, and are free for downloading. The site features the ability to search by type and style, and offers a demonstration of the page view elements of the Theme.

Using Themes

WordPress currently comes with three themes: the default Twenty Fifteen theme, and previous defaults Twenty Fourteen theme and Twenty Thirteen theme. You can switch between Themes using the Appearance admin panel. Themes that you add to the theme directory will appear in the Administration Screen > Appearance > Themes as additional selections.

Adding New Themes

Appearance Panel

There are many Themes available for download that will work with your WordPress installation.

If the Theme that you are installing provides instructions, be sure to read through and follow those instructions for the successful installation of the Theme. It is recommended that Theme developers provide installation instructions for their own Themes, because Themes can provide special optional functionality that may require more steps than the basic installation steps covered here. If your Theme does not work after following any provided instructions, please contact the Theme author for help.

Adding New Themes using the Administration Panels

You can download Themes directly to your blog by using the Add New Themes option in the Appearance sub-menu.

  1. Log in to the WordPress Administration Panels.
  2. Select the Appearance panel, then Themes.
  3. Select Add New.
  4. Either use the Search or Filter options to locate a Theme you would like to use.
  5. Click on the Preview link to preview the Theme or the Install Now link to upload the Theme to your blog,
  6. Or use the Upload link in the top links row to upload a zipped copy of a Theme that you have previously downloaded to your machine.

Adding New Themes by using cPanel

If your host offers the cPanel control panel, and the Theme files are in a .zip or .gz archive follow these instructions. Note: This assumes the Theme you download is a compressed (.zip) file containing a folder under which all the Theme files reside.

  1. Download the Theme .zip file to your local machine.
  2. In cPanel File Manager, navigate to your Themes folder. If your WordPress is installed in the document root folder of your web server you would navigate to "public_html/wp-content/themes" and if you have WordPress installed in a sub-folder called wordpress, you would navigate to "public_html/wordpress/wp-content/themes".
  3. Once you've navigated to the Themes folder in cPanel File Manager, click on Upload file(s) and upload that .zip file you saved in Step 1.
  4. Once the .zip file is uploaded, click on the name of that file in cPanel, then in the panel to the right, click on "Extract File Contents", and that .zip file will be uncompressed.
  5. Follow the instructions below for selecting the new Theme.

Adding New Themes Manually (FTP)

To add a new Theme to your WordPress installation, follow these basic steps:

  1. Download the Theme archive and extract the files it contains. You may need to preserve the directory structure in the archive when extracting these files. Follow the guidelines provided by your Theme author.
  2. Using an FTP client to access your host web server, create a directory to save your Theme in the wp-content/themes directory provided by WordPress. For example, a Theme named Test should be in wp-content/themes/test. Your Theme may provide this directory as part of the archive.
  3. Upload the Theme files to the new directory on your host server.
  4. Follow the instructions below for selecting the new Theme.

Selecting the Active Theme

To select a Theme for your site:

  1. Log in to the WordPress Administration Panels.
  2. Select the Appearance panel, then Themes.
  3. From the Themes panel, roll over the Theme thumbnail image for the Theme you are interested in to see options for that theme.
  4. You can view more information about any theme by clicking Theme Details.
  5. A live preview of any Theme (using your blog's content) can be seen by clicking Live Preview.
  6. To activate the Theme click the Activate button.

Your selection will immediately become active.

Note: If the Theme preview is blank, do not activate the new Theme without investigating further. Your site may not be displayed correctly, otherwise.

Creating Themes

If you are interested in creating your own Theme for distribution, or learning more about the architecture of Themes, please review the documentation regarding Theme Development.

If you simply want to customize your current Theme for your own use, consider creating a Child Theme.