使文章發表的日期有各自的鏈結
使文章發表的日期有各自的鏈結,其意思是——鏈結所屬的年、月、日至所屬的彙整頁面,例如:按下文章發表日期的 2009 年,則會鏈結到 2009 年文章彙整的頁面;當然,在這個前提下,您的佈景主題須有可以顯示彙整功能的檔案,例如 archive.php 檔案。
只要將佈景主題 single.php 檔案中的
<?php the_time() ?>
置換成以下的程式碼就可以了:
<?php
$arc_year = get_the_time('Y');
$arc_month = get_the_time('m');
$arc_day = get_the_time('d');
?>
<a href="<?php echo get_year_link($arc_year); ?>"><?php the_time('Y') ?></a> 年
<a href="<?php echo get_month_link($arc_year, $arc_month); ?>"><?php the_time('m') ?></a> 月
<a href="<?php echo get_day_link($arc_year, $arc_month, $arc_day); ?>"><?php the_time('d') ?></a> 日
上述的程式碼是我將 get_year_link、get_month_link 與 get_day_link 這三篇的內容整合在一起。




