函数wp_get_archives是用来调用存档的,可以放在模板中的sidebar.php或者放在专门的存档页面archives.php。
具体写法如下:
wp_get_archives
(’type=monthly&limit=12&format=
html&before=…&after=…
&show_post_count=true’);
下面说明一下里面的每个函数的意思:
type:归档方式
type=monthly:按月显示
type=daily:按天显示
type=weekly:按周显示
type=postbypost:显示文章标题
limit:显示篇数
limit=10:显示最近10篇文章
format:格式
format=html:默认方式
format=link:输出格式:
<?php
<link rel=’archives’ title=’$title_text’ href=’$url’ />
format=option:输出格式:<?php
<option value=’$url’>$before $text $after</option>
before:archives前
before=…:要在前面加的文字
after:archives后
after=…:要在后面加的文字
show_post_count:是否显示文章数量
show_post_count=true:要在后面显示文章的数量