当前位置:首页 > WordPress > WordPress分类(archives)函数大全

WordPress分类(archives)函数大全

时间:2010-01-3 08:34  分类:WordPress  评论数:0 条  

WordPress中archives.php分类页面就是index.php 文件的 <?php if (have_posts()) : ?><?php while
(have_posts()) : the_post(); ?>中间添加一段分类的代码,下面列出了根据不同参数返回分类列表的wordpress分类函数大全:
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class=”pagetitle”>Archive for the &#8216;<?php
single_cat_title(); ?>&#8217; Category</h2>(根据cate 分类)
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h2 class=”pagetitle”>Posts Tagged &#8216;<?php
single_tag_title(); ?>&#8217;</h2>(根据tag 分类)
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class=”pagetitle”>Archive for <?php the_time(‘F jS, Y’); ?></h2>
(根据day 分类)
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class=”pagetitle”>Archive for <?php the_time(‘F, Y’); ?></h2>(根
据month 分类)
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class=”pagetitle”>Archive for <?php the_time(‘Y’); ?></h2>(根据
year 分类)
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class=”pagetitle”>Author Archive</h2>(根据author 分类)

<?php /* If this is a paged archive */ } elseif (isset($_GET['paged'])
&& !empty($_GET['paged'])) { ?>
<h2 class=”pagetitle”>Blog Archives</h2>(根据page 分类)
<?php } ?>
<?php while (have_posts()) : the_post(); ?>


分享到:



标签: ,

转载请保留出处 - http://www.moneytreeblog.net/wordpress/wordpress-classification-function.html

上一篇:

下一篇:

相关日志

更多推荐阅读

  • 暂无推荐文章

暂时还没有评论.