WordPress:Themes

来自站长百科
跳转至: 导航、​ 搜索


Before the advent of Themes, WordPress generated content using a single file, index.php, and files to support comment display and submission. A single style sheet controlled the presentation. All other pages, including the category and archive pages, were generated by passing parameters to the index.php page.

在主题出现之前,WordPress使用单一的文件index.php创建内容,并且使用文件,递交和显示评论。单一的样式表控制外观。所有其它的网页,包括类别和归档网页,是通过将参数传递到index.php页面,产生的。

The new Theme system provides two convenient features.

新的主题系统提供了两个方便的功能。

Physically Separate Components
The new WordPress modular template files system provides a method to define separate physical PHP files for the different components of your WordPress site. This allows creation of unique designs and functionality for many special pages, such as category archives, monthly archives, and the individual entry pages.

;分开组成部分:新的WordPress模块模板 文件系统提供了一种方法,为WordPress站点的不同部分,定义不同的PHP文件。这样能够为许多特别的网页创建独一的设计和功能,例如类别归档, 按月归档,以及只有一篇文章的网页。

Quickly Change Layout and Design
It allows users with appropriate permissions to quickly change the layout of the entire site by uploading a new theme and essentially flipping a switch in the admin panel.

;快速地更改布局和设计:拥有一定权限的用户,通过上传一个新的主题,按一下管理面板中的按钮,就可以快速地更改整个站点的布局和设计。 The old method of generating pages will still work. If you are upgrading from v1.2 or v1.2.1 or v1.2.2, you can continue using your existing design. Keeping your older design will not prevent you from adding additional themes and easily switching between designs.

创建网页的旧方法仍然适用。如果你从1.2或者1.2.1或者1.2.2版本升级你可以继续使用当前的设计。保持旧的样式,你仍然能够添加主题并且轻易地切换样式。

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.

一般来说,WordPress主题系统是"包装"你的博客外观的方式。但是,主题不仅起着"包装"作用。包装你的站点暗示只有设计更改了。WordPress能够更多地控制你的网站上的材料的外观和呈现方式

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 WordPress:Pages, as well as any necessary code files (*.php). For an introduction to template files, see WordPress:Stepping Into Templates.

WordPress主题指的是一些文件的集合,这些文件一起运行,输出一种图形界面,这个图形界面拥有网页日志的潜在的统一的设计。这些文件称为模板文件。主题可以更改站点的显示方式,但是不会更改潜在的软件。主题可能包含自定义的模板文件,图像文件(*.jpg, *.gif),样式表(*.css),自定义网页,以及任何必要的代码文件(*.php)。关于模板文件的介绍,请看看走进模板。 Themes are a whole new ball game. Let's say you write a lot about cheese and gadgets. Through the innovative 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 WordPress:The Loop in Action and WordPress:Category Templates.

主题是一种全新的情况。假如你写了许多关于奶酪和gadgets的文章。通常创新性地使用WordPress Loop模板文件,你可以自定义你的奶酪类别文章,使得这些文章与你的Gadgets文章看起来不同。能够控制站点上的不同网页和类别的外观之后,你只会受你的想象力的限制了。关于怎样为不同的类别和文章使用不同的主题,请看看运转的Loop类别模板

Get New Themes[ ]

得到新的主题[ ]

The WordPress Theme Viewer 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.

WordPress Theme Viewer是WordPress主题的官方站点,这个站点中的主题得到审查,而且可以免费下载。你可以在这个站点上通过主题的类型和样式搜索主题,而且可以看到主题的网页浏览元素。

Other sources for WordPress Themes may include:

WordPress主题的其它资源,包括:














Using Themes[ ]

使用主题[ ]

WordPress supplies two themes in its distribution for your initial use. You can switch between these two themes using the admin panel. Themes that you add to that directory will appear in the WordPress:Administration Panels > Presentation as additional selections.

你开始使用时,就可以使用WordPress发行的两个主题。你可以使用管理面板,切换使用两个主题。你添加到目录中的主题会出现在管理面板 > Presentation中,作为额外的选项。

Adding New Themes[ ]

添加新的主题[ ]

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

可以下载许多主题,在WordPress中运行。

thumb|right|Presentation Theme PanelIf 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.

thumb|right|Presentation 主题面板如果你安装的主题提供了指示说明,要确定通读这些说明,并且遵循这些说明,以成功地安装主题。建议主题开发人员,为自己的主题提供安装说明,因为主题提供了特别的可选择的功能,这些功能的安装比基本的安装步骤可能更复杂。如果你遵循了任何的说明之后,你的主题仍然不能够运行,请联系主题作者,寻求帮助

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

要为你的WordPress添加一个新的主题,请遵循下面的基本步骤:

  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.
  1. 下载主题归档并且解压这些归档所包含的文件。解压这些文件的时候,你可能需要在归档中保存这些目录结构。遵循主题作者提供的指导。
  1. Using an FTP client to access your host web server, create a directory to contain 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.
  1. 使用FTP client访问你的主机网络服务器,创建一个目录,将主题包含在WordPress提供的wp-content/themes目录。例如,一个名为测试的主题应该包含在wp-content/themes/test。你的主题应该提供这个目录,作为归档的一部分。
  1. Upload the theme files to the new directory on your host server.
  2. 将主题文件上传到你的主机服务器的新目录中。
  1. Follow the [[WordPress:#Selecting_the_Active_Theme|instructions below]] for selecting the new theme.
  1. 遵循[[WordPress:#Selecting_the_Active_Theme|下面的指示]]选择新的主题。

Adding New Themes in cPanel[ ]

在 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 and the files in the zip file are in their 'named' folder.

如果你的主机提供cPanel控制面板,而且主题文件在.zip 或者 .gz归档中,遵循这些指示说明。注:这个前提是你下载的主题是个压缩文件而且压缩文件中的文件在'指定的'文件夹中。

  1. Download the theme zip file to your local machine.
  2. 将主题压缩文件下载到你的本地电脑上。
  1. In cPanel File Manager, navigate to your themes folder. If you have WordPress installed in it's own folder called wordpress, you would navigate to "public_html/wordpress/wp-content/themes" and if WordPress is installed in your web-root folder you would navigate to "public_html/wp-content/themes".
  1. 在cPanel文件管理器中,导航到当你主题文件夹。如果你将WordPress安装在其自身称为wordpress的文件夹中,你将会导航到"public_html/wordpress/wp-content/themes",如果WordPress安装在你的网络根文件夹中,你将会导航到"public_html/wp-content/themes"。
  1. 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.
  1. 你一旦导航到了cPanel文件管理器中的主题文件夹,点击上传文件,上传你在第一步时,保存的压缩文件。
  1. Once the zip file is uploaded, click on the zip file name in cPanel, then in the panel to the right, click on Extract File Contents, and that zip file will be uncompressed.
  1. 上传好压缩文件之后,点击cPanel中的压缩文件名,然后再在右边的面板上,点击提取文件内容,这个压缩文件就会被解压。
  1. Follow the [[WordPress:#Selecting_the_Active_Theme|instructions below]] for selecting the new theme.
  1. 遵循[[WordPress:#Selecting_the_Active_Theme|下面的指示说明]],选择新的主题。

Selecting the Active Theme[ ]

选择 Active 主题[ ]

To select the active theme for your site:

为你的站点选择active主题:

  1. Log in to the WordPress WordPress:Administration Panels.
  1. 登录到WordPress 管理面板
  1. Select the Presentation subpanel.
  2. 选择Presentation子面板。
  1. From the Available Themes section, click on theme title (or theme screenshot) for the theme you wish to activate.
  1. 可获得的主题部分,为你希望激活的主题,点击主题标题(或者主题截屏)。
  1. To view the new look, click View Site at the top of the Panel's screen.
  1. 要访问新的外观,请在面板界面的顶上方点击访问站点

Your selection should immediately become active.

操作立马就会激活。

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 WordPress:Theme Development and WordPress:Designing Themes for Public_Release.

如果你对创建发行主题感兴趣,或者你想要学习更多的关于主题结构的内容,请查看关于主题发展 Designing Themes for Public_Release方面的文档。

Theme Files[ ]

主题文件[ ]

The following are the files typically included within a Theme.

下面是主题中通常包含的文件。









  • 404 模板 = 404.php
  • 归档模板 = archive.php
  • 归档索引页 = archives.php
  • 评论模板 = comments.php
  • 页脚模板 = footer.php
  • 标头模板 = header.php
  • 链接= links.php
  • 主模板 = index.php
  • 网页模板 = page.php
  • 弹出的评论模板 = comments-popup.php
  • 文章模板 = single.php
  • 搜索形式 = searchform.php
  • 搜索模板 = search.php
  • 边栏模板 = sidebar.php
  • 样式表 = style.css



== Moving from 1.2.x to 1.5 ==

== 从1.2.x 移到 1.5 ==

For details on upgrading WordPress and your WordPress Theme from v1.2 to 1.5, see: Upgrade 1.2 to 1.5.

关于将WordPress和你的WordPress主题从1.2版本升级到1.5版本的详细信息,请看看:从1.2升级到1.5

Theme Tools and Other Resources[ ]

主题工具和其它的资源[ ]

These tools and resources will aid you in creating and/or enhancing themes.

这些工具和资源会帮助你,创建和/或者提高主题。

Layout[ ]

布局[ ]



Templates and Template Tags[ ]

模板和模板标签[ ]








Tools and Resources[ ]

工具和资源[ ]


Colors, Graphics, and Fonts[ ]

颜色,图形,和字体[ ]