站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Category Templates
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
= 介绍 = Since the advent of [[WordPress:Using Themes|Themes]] in WordPress 1.5, changing the look and feel of your WordPress site has become fairly straightforward. For instance, when a viewer clicks on a link to one of the Categories on your site, he or she is taken to a page listing the Posts from that particular Category in chronological order, from newest Posts at the top to oldest at the bottom. There are many display choices, including whether to display the complete post or post excerpts, and what additional information to display (title, author, publish date, last modified time, etc.). Each theme makes different choices, and you might want to change them. 自从WordPress1.5版本的[[WordPress:Using Themes|主题]]的产生,更改WordPress站点的外观和整体效果变得非常简单。例如,当一个访客点击链接,链接到你的站点的某个类别的时候,他或者她会来到网页,网页按时间顺序列出了某个类别的所有文章,最新发表的文章在最上面,越早发表的文章越在下面。文章可以以许多种方式显示,包括是否显示整篇文章还是显示文章摘录,显示什么样的额外信息(标题,作者,发表日期,最新更改的时间,等等)。每个主题都可以拥有许多不同的选择,而且你可能想要更改这些选择。 This article explains how to change what happens when the blog viewer is visiting one of your site's Category pages. This involves the use of Themes and Template files, so if you are new to template files, you might want to read [[WordPress:Using Themes]] and [[WordPress:Stepping Into Templates]] first. 这篇文章解释了,博客访客访问你的站点某个类别的网页的时候,会出现什么情况。这包括使用主题和模板文件,因此,如果你是模板文件新手,你可能想要首先阅读[[WordPress:Using Themes|使用主题]] 和[[WordPress:Stepping Into Templates|走进模板]]。 == What Template File is Used? == == 模板文件用来做什么? == The first step in modifying what happens when someone visits a Category page is to figure out which of your theme's files is going to be used to display the posts. This is known as the [[WordPress:Template Hierarchy]]. 当某人访问类别网页的时候,更改发生什么的第一步是要了解,会使用你的哪个主题的文件,来显示文章。这又称为[[WordPress:Template Hierarchy|模板层级]]。 In the case of categories, the hierarchy is fairly simple. For instance, suppose the ID number of the Category in question is '''6'''. The Template Hierarchy specifies that WordPress will use the ''first'' Template file it finds in your current Theme's directory from the following list: 关于类别方面,层级非常简单。例如,假如正被讨论的类别ID数字为'''6'''。模板层级规定WordPress使用,WordPress在下面列表中你的当前主题目录中找到的''第一个''模板文件: #<tt style="font-weight:bold; color:#036">category-6.php</tt> #<tt style="font-weight:bold; color:#036">category.php</tt> #<tt style="font-weight:bold; color:#036">archive.php</tt> #<tt style="font-weight:bold; color:#036">index.php</tt> #<tt style="font-weight:bold; color:#036">category-6.php</tt> #<tt style="font-weight:bold; color:#036">category.php</tt> #<tt style="font-weight:bold; color:#036">archive.php</tt> #<tt style="font-weight:bold; color:#036">index.php</tt> That is, if you do not have a <tt style="font-weight:bold; color:#036">category-6.php</tt>, WordPress will check for a <tt style="font-weight:bold; color:#036">category.php</tt>, and so on. 就是说,如果你没有<tt style="font-weight:bold; color:#036">category-6.php</tt>,WordPress会查找<tt style="font-weight:bold; color:#036">category.php</tt>,等等。 So, if you want to make the Category whose ID number is 6 look different from what it is currently (and different from other Category pages), you would want to create a <tt>category-6.php</tt> file. If you want to make all Category pages look different from other archive pages (such as date and author archives), then you would want to create or modify the <tt>category.php file</tt>. If you want to make changes to the look of all archive pages, you can create or modify the <tt>archive.php</tt> file. And if you modify the <tt>index.php</tt> file, you will affect your entire blog. 因此,如果你想要使得ID为6的类别看起来与当前的类别不同(而且与其它的类别网页也不同),你可能想要创建<tt>category-6.php</tt>文件。如果你想要使得所有的类别网页看起来与其它的归档网页不同(例如日期和作者归档),那么你可能想要创建或者更改<tt>category.php file</tt>。如果你想要更改所有的归档网页的外观,你可以创建或者更改<tt>archive.php</tt>文件。而且如果你更改了<tt>index.php</tt> 文件,你的整个博客都会受到影响。 If you need to create a new file, it is a good idea to copy it from the next file in the hierarchy that exists. For instance, if you want a special display for Category 6, begin by copying the <tt>category.php</tt> file, or if you don't have one, use <tt>archive.php</tt>, and so on. 如果你想要创建一个新的文件,从存在的模板层级中的下一个文件中复制文件,是个好主意。例如,如果你想要特别显示类别6,首先复制<tt>category.php</tt>文件,或者如果你没有这个文件,使用<tt>archive.php</tt>,等等。
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)