<?php
$categorys = array(array(29,0),array(58,0),array(39,0),array(59,10),array(27,10) );
for ($i=0; $i<count($categorys); $i++) :
if ($categorys[$i][1] == 0) {
query_posts('orderby=modified&order=DESC&showposts=-1&cat='.$categorys[$i][0]);
$num_post = "Showing all posts";
}
else {
query_posts('orderby=modified&order=DESC&showposts='.$categorys[$i][1].'&cat='.$categorys[$i][0]);
$num_post = "Showing recent ".$categorys[$i][1]." posts";
}
?>
<h2><a href="http://yourwordpress.net/wordpress/worklog/?cat=<?php echo $categorys[$i][0]; ?>"><?php echo esc_html(get_catname($categorys[$i][0])); ?></a></h2>
<p><?php echo $num_post."; "; ?><a href="http://yourwordpress.net/wordpress/worklog/wp-admin/post-new.php?defaultcatid=<?php echo $categorys[$i][0]; ?>">add new</a></p>
<ul>
<?php
if (have_posts()) : while (have_posts()) : the_post();
?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> (<? the_modified_date(); ?>) <a href="http://yourwordpress.net/wordpress/worklog/wp-admin/post.php?post=<?php the_ID();?>&action=edit">...edit</a></li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<li><?php echo esc_html(get_catname($categorys[$i][0]))."はまだありません。"; ?></li>
</ul>
<?php endif; ?>
<?php endfor; ?>
<?php WP_reset_query(); ?>
// query_posts()の状態をページ表示時の状態に戻す。