只显示标题的方法

 

如何让首页和分类列表页只显示文章标题列表呢?在网上找了很久,终于找到了最好的解决办法。
一 如果是首页就在主题管理的index.php文件中找到显示全文的函数: <?php the_content(); ?>
如果是分类目录就在ARCHIVE.PHP或category.php文件中查找

二 这个代码所属div层作用是显示该文摘或文章全文。比如该层代码:
<div class=”entry”>
<?php the_content(’Read the rest of this entry ?’); ?>
</div>

将它们替换为:
<div class=”entry”>
<?php the_excerpt(); ?>
<br>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”进入<?php the_title();?>”>阅读”<?php the_title(); ?>”全文</a>
</div>

或替换为:
<div class=”entry”>
<?php if(is_category() || is_archive() || is_home() ) {
the_excerpt();
} else {
the_content(’Read the rest of this entry ?’);
} ?>
<div class=”details”><div class=”inside”>
<?php comments_popup_link(’No Comments’,’1 Comment’,’% Comments’); ?> so far | <a href=”<?php
the_permalink() ?>”>阅读全文?</a></div></div>
</div>

三 以上方法显示wordpress摘要,其中的<?php the_excerpt(); ?>显示摘要函数。你在编辑发表文章时仍然需要点击编辑器上那个”split post with more tag”按钮(快捷方式是Alt+t )。

那么如何让wordpress首页或分类目录只显示文章的标题列表呢?方法很简单:直接把这个层里代码都删掉,只留下:
<div class=”entry”>
</div>


更多wordpress知识请时刻关注 深圳网站建设网络工作室的专用博客,也可去 深圳网站建设网络基地了解更多建站知识!

 


本文固定链接: http://www.fanyun.ltd/201.html | 凡云阁

fanyun
作者:fanyun 于2011年10月31日发表 & 关键词:
除非注明 否则文章均为原创,转载请注明出处: 只显示标题的方法 | 凡云阁
【上一篇】
【下一篇】

只显示标题的方法:等您坐沙发呢!

发表评论

亲,不支持纯字母、符号评论哦~