WordPress:Using Themes

来自站长百科
Xxf3325讨论 | 贡献2008年4月8日 (二) 12:02的版本
跳转至: 导航、​ 搜索

在没有出现主题之前,WordPress使用一个单独的文件,产生的内容,index.php,将内容归档以支持显示评论和提及评论。一个单一的样式表控制了这些的呈现情况。所有的其它页面,包括一个类别和归档页面,都是通过将参量传到index.php 页面上产生的。

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

外在分开的组成部分:新的WordPress模块化模板文件系统提供一种方法,为你的WordPress站点的不同组成部分定义单独的 PHP文件,。这样可以为许多特别的页面创建独一的设计和功能,例如类别归档, 每月的归档, 以及个别的文章页面。

:快速改变布局和设计:它允许拥有合适权限的用户,通过上传新的主题,特别是在管理面板上点击一个按钮,来快速地改变整个站点的布局。 产生页面的老方法仍然奏效。如果你是从v1.2或者 v1.2.1或者 v1.2.2上升级的, 你可以继续使用你现有的设计。保存老的设计不会阻止你添加额外的主题,也不会阻止你在两个设计之间轻松地切换。

主题是什么?

基本来说,WordPress主题系统是给你的博客"加皮肤"的方式。然而,它又不仅仅是一个"皮肤。"给你的站点改变皮肤,只能暗示只是设计改变了。WordPress主题能给你的站点上材料的外观和呈现提供更多的控制。

一个WordPress主题是一些文件的集合,共同运行来产生一个图画似的界面,这个界面有一个潜在的统一的博客设计。这些文件称作模板文件。一个主题更改站点的显示方式,但是并没有更改潜在的软件。主题可能包括自定义的模板文件,图像文件(*.jpg, *.gif),形式表(*.css),自定义页面,以及任何必须的代码文件(*.php).关于模板文件的介绍说明,看看走进模板

主题是一个完全新的局面。假如你写了许多关于奶酪和小配件的文章。通过创新地使用WordPress Loop模板文件,你可以自定义你的奶酪文章类别,使它看起来与你的小配件类别有所不同。你可以有力地控制你的站点上不同页面和类别的外观,你只受你的想象力所限制。关于怎样为不同的类别或者文章使用不同的主题的信息,请看运转的Loop和[[Wordpress:Category Templates|类别模板]

得到新的主题

WordPress 主题阅读器是WordPress主题的官方站点,已经得到了检查和核实,而且还可以免费下载。这个站点的特色,是能够通过形式和风格进行搜索,并且提供了一个主题页面阅读元素的一个例证。

其它的WordPress主题的原始资料可能包括:

Alex King的 WordPress 主题竞争

使用主题

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在你首次使用时,给你提供两个主题。你可以使用管理面板在两个主题之间进行切换。你添加到那个目录上的主题会在管理面板 > 呈现上作为额外的选择出现。

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|呈现 主题 面板如果你安装的主题提供介绍说明,确保通读了一遍,遵循这些介绍说明来成功地安装主题。据推荐,主题程序员为他们的自己的主题提供了安装介绍说明。, 因为主题可能提供了特别的选项的功能,这些功能的安装可能比基本安装的步骤要多几步。如果在遵从了任何提供的说明以后,你的主题仍然不能运行,请联系主题作者寻求帮助


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.
  2. 下载主题存档,提取它包含的文件。当你提取这些文件的时候,你可能要在存档中保存目录结构。遵从你的主题作者提供的指导方针。
  3. 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.
  4. 使用一个FTP client来接近你的主机网络服务器,创建一个目录,将你的主题包含在WordPress提供的目录wp-content/themes。例如,一个主题名'测试应该在wp-content/themes/test.你的主题可能规定这个目录为存档的一部分。
  5. Upload the theme files to the new directory on your host server.
  6. 将主题文件上传到你的主机服务器的新目录上。
  7. Follow the [[Wordpress:#Selecting_the_Active_Theme|instructions below]] for selecting the new theme.
  8. 遵从[[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控制面板,而且主题文件在一个a .zip 或者 .gz存档中,遵从这些指示说明。注:这样做的前提是你下载的主题是一个压缩的文件(压缩)而且压缩文件中的文件在他们的'指定的'文件夹中。

  1. Download the theme zip file to your local machine.
  2. 将主题压缩文件下载到你的本地机器上。
  3. 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".
  4. 在cPanel文件管理器,导航到你的主题文件夹。如果你将WordPress安装在它自己的称作wordpress的文件夹上,你会导航到"public_html/wordpress/wp-content/主题",如果你将WordPress安装在你的网页根目录上,你会导航到"public_html/wp-content/主题"。
  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.
  2. 你一旦导航到了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.
  2. 一旦上传了压缩的文件,在cPanel上点击压缩文件名,然后在右边的面板上,点击提取的文件内容,这样压缩的文件就会解压缩了。
  3. Follow the [[Wordpress:#Selecting_the_Active_Theme|instructions below]] for selecting the new theme.
  4. 遵循[[Wordpress:#Selecting_the_Active_Theme|下面的指示说明]]来选择新的主题。

Selecting the Active Theme

选择活动的主题

To select the active theme for your site: 为你的站点选择活动的主题:

  1. Log in to the WordPress Wordpress:Administration Panels.
  2. 登录到WordPress 管理面板
  1. Select the Presentation subpanel.
  2. 选择呈现子面板。
  3. From the Available Themes section, click on theme title (or theme screenshot) for the theme you wish to activate.
  4. 可利用的主题 部分,为你想要使其活动的主题,点击主题标题(或者主题屏幕截图)
  5. To view the new look, click View Site at the top of the Panel's screen.
  6. 要看看新的外观,在面板界面的上方,点击观看站点

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.

如果你对创建自己的主题,并且将它发行,感兴趣,或者你有兴趣学习更多关于主题的结构,请回顾一下关于主题发展为公共发行设计主题的文件。


Theme Files

主题文件

The following are the files typically included within a Theme. 如下的是一些包含在一个主题里面典型的一些文件。

  • Comments Template = comments.php
  • 评论模板 = comments.php
  • Footer Template = footer.php
  • 页脚模板 = footer.php
  • Links = links.php
  • 链接 = links.php
  • Main Template = index.php
  • 主要的模板 = index.php
  • Popup Comments Template = comments-popup.php
  • 弹出来的评论模板 = comments-popup.php
  • Post Template = single.php
  • 文章模板 = single.php
  • Search Form = searchform.php
  • 搜索论坛 = searchform.php
  • Stylesheet = style.css
  • 形式表 = 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主题从v1.2升级到v1.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

颜色,图形与字体