WordPress: Separating Categories:修订间差异
来自站长百科
Seadragon530(讨论 | 贡献) 无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
__TOC__ | __TOC__ | ||
你的文章是用不同分类存档的。分类信息通常显示在文章附近的[[WordPress:Post_Meta_Data_Section|文章 meta 数据部分]]或者是在[[WordPress:Designing Headings|头部标题]]下面。不同的[[WordPress:Using Themes|WordPress 主题]]会在不同的区域高亮显示文章meta信息部分。 | 你的文章是用不同分类存档的。分类信息通常显示在文章附近的[[WordPress:Post_Meta_Data_Section|文章 meta 数据部分]]或者是在[[WordPress:Designing Headings|头部标题]]下面。不同的[[WordPress:Using Themes|WordPress 主题]]会在不同的区域高亮显示文章meta信息部分。 | ||
文章分类的显示是通过<tt>[[WordPress:Template_Tags/the_category|the_category()]]</tt>模板标签的使用来生成的。你可以设计这些分类如何显示。 | 文章分类的显示是通过<tt>[[WordPress:Template_Tags/the_category|the_category()]]</tt>模板标签的使用来生成的。你可以设计这些分类如何显示。 | ||
==找出分类标签== | ==找出分类标签== | ||
你的分类标签可能放在首页面,也可能放在一个或多个单独文章页面的不同地方,这样你可能不得不费点力气来寻找你不同的分类标签了。你可能还想设计一个与众不同的标签,但首先要把它们找出来。 | 你的分类标签可能放在首页面,也可能放在一个或多个单独文章页面的不同地方,这样你可能不得不费点力气来寻找你不同的分类标签了。你可能还想设计一个与众不同的标签,但首先要把它们找出来。 | ||
在整个主题中,带有你的分类标签的'''文章 meta 数据''',通常可以在<tt>index.php</tt>, <tt>single.php</tt>,或者有时在<tt>sidebar.php</tt> [[WordPress:Templates|模板文件]]中可以找到。打开一个或者多个模板文件并搜索: | 在整个主题中,带有你的分类标签的'''文章 meta 数据''',通常可以在<tt>index.php</tt>, <tt>single.php</tt>,或者有时在<tt>sidebar.php</tt> [[WordPress:Templates|模板文件]]中可以找到。打开一个或者多个模板文件并搜索: | ||
<pre><?php the_category() ?></pre> | <pre><?php the_category() ?></pre> | ||
一旦找到之后,再看看网页,然后决定如何更改这些信息。 | 一旦找到之后,再看看网页,然后决定如何更改这些信息。 | ||
<tt>[[WordPress:Template_Tags/the_category|the_category()]]</tt>模板标签指导数据库获得关于文章分类的信息,并且在[[WordPress:Templates|模板文件中]]显示出来。默认情况下,它显示分类的列表,每两个分类中间有空格隔开。你可以通过添加标签内部的参数更改它们。让我们通过分类名:''WordPress'', ''Computers'', and ''Internet News'',从简单的分隔器开始。 | <tt>[[WordPress:Template_Tags/the_category|the_category()]]</tt>模板标签指导数据库获得关于文章分类的信息,并且在[[WordPress:Templates|模板文件中]]显示出来。默认情况下,它显示分类的列表,每两个分类中间有空格隔开。你可以通过添加标签内部的参数更改它们。让我们通过分类名:''WordPress'', ''Computers'', and ''Internet News'',从简单的分隔器开始。 | ||
==简单的分隔器== | ==简单的分隔器== | ||
第43行: | 第21行: | ||
<pre><?php the_category(',') ?></pre> | <pre><?php the_category(',') ?></pre> | ||
显示结果如下: | 显示结果如下: | ||
<div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress, Computers, Internet News</div> | <div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress, Computers, Internet News</div> | ||
如果你还想要有一个箭头,标签内容如下 | 如果你还想要有一个箭头,标签内容如下 | ||
第63行: | 第31行: | ||
<div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress > Computers > Internet News</div> | <div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress > Computers > Internet News</div> | ||
如果你想有一个[[WordPress:Fun_Character_Entities|bullet]]符号,标签内容如下: | 如果你想有一个[[WordPress:Fun_Character_Entities|bullet]]符号,标签内容如下: | ||
第76行: | 第38行: | ||
<div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress • Computers • Internet News</div> | <div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress • Computers • Internet News</div> | ||
如果你想要在分类中间加入"pipe" ( | )符号,这个标签内容如下: | 如果你想要在分类中间加入"pipe" ( | )符号,这个标签内容如下: | ||
第87行: | 第44行: | ||
<div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress | Computers | Internet News</div> | <div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress | Computers | Internet News</div> | ||
==向分类中添加文本== | ==向分类中添加文本== | ||
第106行: | 第53行: | ||
<div style="font-size: 105%; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">You can read related subjects in the <span style="color:blue">WordPress</span> and <span style="color:blue">Computers</span> and <span style="color:blue">Internet News</span> categories.</div> | <div style="font-size: 105%; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">You can read related subjects in the <span style="color:blue">WordPress</span> and <span style="color:blue">Computers</span> and <span style="color:blue">Internet News</span> categories.</div> | ||
或者你可以给它们更多的选择,把'''"and"''' 改成'''"or"''': | 或者你可以给它们更多的选择,把'''"and"''' 改成'''"or"''': | ||
第115行: | 第58行: | ||
<div style="font-size: 105%; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">You can read related subjects in the <span style="color:blue">WordPress</span> or <span style="color:blue">Computers</span> or <span style="color:blue">Internet News</span> categories.</div> | <div style="font-size: 105%; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">You can read related subjects in the <span style="color:blue">WordPress</span> or <span style="color:blue">Computers</span> or <span style="color:blue">Internet News</span> categories.</div> | ||
可能性是无限的。运用你的想象力,玩的开心! | 可能性是无限的。运用你的想象力,玩的开心! |
2008年4月15日 (二) 17:32的最新版本
你的文章是用不同分类存档的。分类信息通常显示在文章附近的文章 meta 数据部分或者是在头部标题下面。不同的WordPress 主题会在不同的区域高亮显示文章meta信息部分。
文章分类的显示是通过the_category()模板标签的使用来生成的。你可以设计这些分类如何显示。
找出分类标签[ ]
你的分类标签可能放在首页面,也可能放在一个或多个单独文章页面的不同地方,这样你可能不得不费点力气来寻找你不同的分类标签了。你可能还想设计一个与众不同的标签,但首先要把它们找出来。
在整个主题中,带有你的分类标签的文章 meta 数据,通常可以在index.php, single.php,或者有时在sidebar.php 模板文件中可以找到。打开一个或者多个模板文件并搜索:
<?php the_category() ?>
一旦找到之后,再看看网页,然后决定如何更改这些信息。
the_category()模板标签指导数据库获得关于文章分类的信息,并且在模板文件中显示出来。默认情况下,它显示分类的列表,每两个分类中间有空格隔开。你可以通过添加标签内部的参数更改它们。让我们通过分类名:WordPress, Computers, and Internet News,从简单的分隔器开始。
简单的分隔器[ ]
如果你想在分类中间加上逗号,标签内容如下:
<?php the_category(',') ?>
显示结果如下:
WordPress, Computers, Internet News
如果你还想要有一个箭头,标签内容如下
<?php the_category(' > ') ?>
WordPress > Computers > Internet News
如果你想有一个bullet符号,标签内容如下:
<?php the_category(' • ') ?>
WordPress • Computers • Internet News
如果你想要在分类中间加入"pipe" ( | )符号,这个标签内容如下:
<?php the_category(' | ') ?>
WordPress | Computers | Internet News
向分类中添加文本[ ]
你想让你的文章meta数据看起来更象文字,非正式并且象是一段文章而不是列表吗?你可以在分类中间加入"and",如下:
<p>You can read related subjects in the <?php the_category(' and ') ?> categories.</p>
You can read related subjects in the WordPress and Computers and Internet News categories.
或者你可以给它们更多的选择,把"and" 改成"or":
You can read related subjects in the WordPress or Computers or Internet News categories.
可能性是无限的。运用你的想象力,玩的开心!