好的,所以我想你可能想要的是做这个说,最后50个职位。
循环在过去n
帖子,提取每个标签的每个帖子的term_id
,然后传递串入的wp_tag_cloud()
的include
参数;
$how_many_posts = 50;
$args = array(
'posts_per_page' => $how_many_posts,
'orderby' => 'date',
'order' => 'DESC',
);
// get the last $how_many_posts, which we will loop over
// and gather the tags of
query_posts($args);
//
$temp_ids = array();
while (have_posts()) : the_post();
// get tags for each post
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
// store each tag id value
$temp_ids[] = $tag->term_id;
}
}
endwhile;
// we're done with that loop, so we need to reset the query now
wp_reset_query();
$id_string = implode(',', array_unique($temp_ids));
// These are the params I use, you'll want to adjust the args
// to suit the look you want
$args = array(
'smallest' => 10,
'largest' => 30,
'unit' => 'px',
'number' => 150,
'format' => 'flat',
'separator' => "\n",
'orderby' => 'count',
'order' => 'DESC',
'include' => $id_string, // only include stored ids
'link' => 'view',
'echo' => true,
);
wp_tag_cloud($args);
他们确实没有时间戳。然而,由于它们与帖子相关,并且帖子确实有时间戳,我认为应该可以检索这些时间戳。不过你的回复让我想到了。将标签添加时间戳不是最简单的吗? – Nordin 2010-06-01 13:10:43