编辑“WordPress:Template Tags/wp tag cloud

跳转至: 导航、​ 搜索
警告:您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您登录创建一个账户,您的编辑将归属于您的用户名,且将享受其他好处。

该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。

最后版本 您的文本
第83行: 第83行:


== 创建一个标签存档==
== 创建一个标签存档==
While the new tagging feature in 2.3 is a great addition, the wp_tag_cloud tag can be used to display a Tag Archive.  What this means is that when a visitor clicks on any particular tag a page displaying the tag cloud and all posts tagged the same will be displayed.  According to the [[WordPress:Template_Hierarchy#Tag_page|Template_Hierarchy]] if a tag.php template does not exist then the archives.php template will be used.  By making this tag.php template you can customize the way your Tag Archive will look, this template includes the tag cloud at the top for very easy navigation.
虽然这个新的标签功能是2.3版本中添加的一个重要功能,wp_tag_cloud标签可以被用来显示标签存档。这指的是,当一个访客在一个显示标签的网页上点击任何标签的时候,标签cloud和所有标签相同的文章都会显示。根据[[WordPress:Template_Hierarchy#Tag_page|Template_Hierarchy]],如果tag.php模板不存在,那么就会使用archives.php。通过制作这个tag.php模板,你可以自定义你的博客归档的外观,这个模板在顶端包含有标签cloud,使得导航变得相当简单。
虽然这个新的标签功能是2.3版本中添加的一个重要功能,wp_tag_cloud标签可以被用来显示标签存档。这指的是,当一个访客在一个显示标签的网页上点击任何标签的时候,标签cloud和所有标签相同的文章都会显示。根据[[WordPress:Template_Hierarchy#Tag_page|Template_Hierarchy]],如果tag.php模板不存在,那么就会使用archives.php。通过制作这个tag.php模板,你可以自定义你的博客归档的外观,这个模板在顶端包含有标签cloud,使得导航变得相当简单。
To do this a new template will need to be added to your theme files.  These are good resources for everything pertaining to [[WordPress:Templates|templates]], [[WordPress:Template_Hierarchy#Tag_page|Template_Hierarchy]].  Basic steps needed are


要做到这一点,要将一个新的模板添加到你的主题文件中。有许多关于 [[WordPress:Templates|模板]], [[WordPress:Template_Hierarchy#Tag_page|Template_Hierarchy]]的资源。基本的步骤是:
要做到这一点,要将一个新的模板添加到你的主题文件中。有许多关于 [[WordPress:Templates|模板]], [[WordPress:Template_Hierarchy#Tag_page|Template_Hierarchy]]的资源。基本的步骤是:
*1. Create file with the contents below named tag.php.


*1.创建文件,文件中有内容,文件名为tag.php。
*1.创建文件,文件中有内容,文件名为tag.php。
*2. Upload file to your themes directory.
*2.将文件上传到你的主题目录中。


*2.将文件上传到你的主题目录中。
*3. '''This is optional only if you would like to have a link in your page navigation to the Tag archive, otherwise when clicking on a tag this template will be used.''' 


*3. '''如果你希望网页导航中有一个链接,链接到标签归档,这是可选择的,否则的话,点击标签,就会用到这个模板。'''   
*3. '''如果你希望网页导航中有一个链接,链接到标签归档,这是可选择的,否则的话,点击标签,就会用到这个模板。'''   
**Create a new blank page using this template, give this page the title Tag Archive.


**使用这个模板创建一个新的空白网页,将这个网页赋予标题为标签存档。
**使用这个模板创建一个新的空白网页,将这个网页赋予标题为标签存档。
To elaborate more on step three.
详细描述第三步。


详细描述第三步。
WordPress can be configured to use different Page Templates for different Pages. Toward the bottom of the Write->Write Page administration panel (or on the sidebar, depending on which version of WordPress you are using) is a drop-down labeled "Page Template". From there you can select which Template will be used when displaying this particular Page.


可以设置WordPress,为不同的网页使用不同的网页模板。在写->编写网页管理面板的底部(或者在工具条上,取决于你正在使用哪个版本的WordPress)是一个下拉列表,标记为"网页模板"。在这个模板上,你可以选择显示这个特殊的网页的时候,使用哪个模板。
可以设置WordPress,为不同的网页使用不同的网页模板。在写->编写网页管理面板的底部(或者在工具条上,取决于你正在使用哪个版本的WordPress)是一个下拉列表,标记为"网页模板"。在这个模板上,你可以选择显示这个特殊的网页的时候,使用哪个模板。
<pre>
<?php /*
Template Name: Tag Archive
*/ ?>
<div>
<?php get_header(); ?>
<h2>Tag Archive</h2>
<?php wp_tag_cloud(''); ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
</div>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="entry">
<?php the_content('Read the rest of this entry &raquo;'); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>
</pre>


<pre>
<pre>
第123行: 第165行:
<?php get_footer(); ?>
<?php get_footer(); ?>
</pre>
</pre>
Please Note that styling has not been added to this template.  A good way to determine the structure that your theme uses is to view the single.php theme file.


请注意这个模板没有添加样式。决定你的主题使用什么结构的一个好办法,就是访问single.php主题文件。
请注意这个模板没有添加样式。决定你的主题使用什么结构的一个好办法,就是访问single.php主题文件。
== Related ==


== 相关的==
== 相关的==
{{Tag post Tags}}
{{PHP Function Tag Footer}}
{{Stub}}


{{标签文章 标签}}
{{标签文章 标签}}
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅Wordpress-mediawiki:版权的细节)。 未经许可,请勿提交受版权保护的作品!
取消 编辑帮助(在新窗口中打开)