站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Tag 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: #<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> 关于类别,层级非常简单。例如,假如讨论的类别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> 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:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)