previous_post_link[前後ページへのリンク]
前後に記事が無い場合
$previous_post = get_previous_post(); $next_post = get_next_post(); if($previous_post||$next_post){ echo '<ul class="page_nav">'; if(!empty($previous_post)){ previous_post_link('<li class="prev">&laquo; %link</li>','%title'); } if(!empty($next_post)){ next_post_link('<li class="next">&raquo; %link</li>','%title'); } echo '</ul>'; } $previous_post = get_previous_post(true); $next_post = get_next_post(true); if($previous_post||$next_post){ echo '<ul class="page_nav">'; if(!empty($previous_post)){ previous_post_link('<li class="prev">&laquo; %link</li>','%title',true); } if(!empty($next_post)){ next_post_link('<li class="next">&raquo; %link</li>','%title',true); } echo '</ul>'; }