当前位置:首页 > WordPress > WordPress分类(archives)函数大全
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 ‘<?php
single_cat_title(); ?>’ Category</h2>(根据cate 分类)
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h2 class=”pagetitle”>Posts Tagged ‘<?php
single_tag_title(); ?>’</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
相关日志
更多推荐阅读
- 暂无推荐文章

2005年以前,我和其他人一样不相信通过网络可以赚到钱,直到收到Google的第一张支票。开这个网站的初衷就是为了搭建一个大家相互交流的平台。如果您对博客赚钱感兴趣,或者对本站有任何的建议或意见,欢迎与我联系:



暂时还没有评论.