改佈景老是找不到這段程式碼,順便在部落格上留個記錄 @@
showposts' => 5
這邊的5就是顯示5篇。
$category){
$catid = $category->term_id;
}
$args = array('orderby' => 'rand','showposts' => 5,'cat' => $catid );
$query_posts = new WP_Query();
$query_posts->query($args);
while ($query_posts->have_posts()) : $query_posts->the_post();
?>
- [1]