WordPress 標題式分類列表


一直覺得 WordPress的分類列表很醜又很難用,文章一多就很難找!

很想弄成只有標題列表就好了,像這樣不是很簡潔有力嗎?

今天好不容易提早把手邊的工作告一段落,所以有點時間就開始動手來改囉~分類列表要改的是 archive.php

1.找到

<h1>Posts under &#8216;<?php single_cat_title(); ?>&#8217;</h1>

改成(不改也可以,只是把 Posts under改成中文字而已,也可以改成你想要的)

<h1>分類列表於 &#8216;<?php single_cat_title(); ?>&#8217;</h1>

2.找到

<div id="post-<?php the_ID(); ?>">
<span><abbr title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php the_time('M d'); ?></abbr></span>
<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
 
<div>
<!--<address><?php _e('by '); ?><a href="<?php the_author_url(); ?>"><?php the_author(); ?></a>. </address>-->
<?php comments_popup_link('No comments yet', '1 comment', '% comments', 'comments-link', 'Comments are off for this post'); ?>
<?php edit_post_link('Edit', '[', ']'); ?>
</div>
 
<div>
<?php the_excerpt(); ?>
</div>
</div><!--.entry-->

整串取代成

<li>
<div id="post-<?php the_ID(); ?>">
<font class="entry-content"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permalink a <?php the_title_attribute(); ?>"><?php the_title(); ?></a></font><font size="9pt">(<?php comments_popup_link('0 回應', '1 回應', '% 回應'); ?>)<?php edit_post_link('Edit', '[', ']'); ?>|Post on <?php the_time('Y-m-d') ?></font>
</div>
</li>

就完成囉~~

當然這是我自己編排的格式啦~字型的css和日期的排列與格式都是我自己設定的,
建議你自己修改css的設定喔!不然出來的樣子恐怕會不大一樣~

如果你改好之後發現文章列表永遠都只有一條的話!
請到後台的設定→閱讀去設定文章顯示數量就可以了!

你可以延伸閱讀以下文章:

網友回應

Tags: