wp_get_archives()

描述

wp_get_archives() 是基于日期的归档列表函数,可以放在等你的WordPress主题模板任意位置。

用法

 

默认用法

<?php $args = array( 'type' => 'monthly',
	'limit'           => '',
	'format'          => 'html', 
	'before'          => '',
	'after'           => '',
	'show_post_count' => false,
	'echo'            => 1,
	'order'           => 'DESC',
        'post_type'     => 'post'
);
wp_get_archives( $args ); ?>

默认情况下,用法显示:

  • 显示每月档案链接
  • 显示所有档案(不限数量)
  • 以降序显示
  • HTML列表中的存档每个链接之前或之后都没有显示
  • 不显示帖子数量

参数

type

(字符串) 显示列表的类型。默认的WordPress设置。有效值:
■ yearly
■ monthly – 默认值
■ daily
■ weekly
■ postbypost (按照发布时期排序)
■ alpha (例如 postbypost 但是文章按照文章标题排序)

limit

(整数) 获得的文章数量,默认没有限制。
format

◆ (字符串) 文章的列表格式。有效值:
◆ html – 在HTML的列表中

  • 标签和前后字符串。这是默认的。
    ◆ option – 在选项