小灰博客--小灰IT技术博客 | sky00.com

如何让wordpress主页显示标题和摘要

让wordpress主页显示标题和摘要 而不是标题加全文的办法:

首先找到wp-content/themes下你使用的模板目录,查找目录中的文件,如果有home.php则修改home.php,没有的话就修改index.php,找到<?php the_content(); ?>这一行,将其修改为以下代码:

1
2
3
4
5
6
&lt;?php if(is_category() || is_archive() || is_home() ) {
the_excerpt();
} else {
the_content('Read the rest of this entry &amp;raquo;');
} ?&gt;
&lt;div&gt;&lt;div&gt;&lt;?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?&gt; so far | &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;Read On &amp;raquo;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;

  这时,你的WordPress首页和分类就显示为摘要信息而不是全文信息了。


如果该文章帮到了您,不妨帮忙分享支持下博主!
同时也欢迎各位技术爱好者加入IT技术群(点击即可):70035098 互相交流学习!

分享该文章到:


发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

分类

最新评论