网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

wordpress全文 wordpress全文检索方案

wordpress首页显示文章的全部内容怎么办

首先,到wordpress后台,依次选择 外观--编辑--选择右边的index.php文件,在里面可以看到语句

成都创新互联公司"三网合一"的企业建站思路。企业可建设拥有电脑版、微信版、手机版的企业网站。实现跨屏营销,产品发布一步更新,电脑网络+移动网络一网打尽,满足企业的营销需求!成都创新互联公司具备承接各种类型的成都网站制作、网站设计、外贸网站建设项目的能力。经过十载的努力的开拓,为不同行业的企事业单位提供了优质的服务,并获得了客户的一致好评。

?php while ( have_posts() ) : the_post(); ?

?php get_template_part( 'content', get_post_format() ); ?

?php endwhile; ?

其次可以看出,index.php是嵌套一个 content.php 的文件用于专门显示文章的内容,这就是为什么在首页老是显示文章全文。那么,打开content.php文件找到

?php

the_content( __( 'Continue reading span→/span', 'twentyeleven' ) );

?

将它修改为

?php if(!is_single()) {

the_excerpt();

} else {

the_content(__('(more…)'));

} ?

最后,保存,就显示摘要了。

WordPress,发布的文章在页面上是全文显示,我想要的是显示文章摘要。不用插件,只用代码。效果

直接在写文章的时候添加手动摘要就行,如果还是不行,就用

?php if($has_thumbnail) :?

div class="post-thumbnail"a href="?php the_permalink() ?" rel="bookmark"img src="?=$thumbnail["src"];?" alt="?php the_title();?" //a/div

div class="post-content"

?php if(has_excerpt())

 echo "p" . mb_strimwidth(strip_tags($post-post_excerpt),0,290,'…'). "/p";//判断是否存在手动摘要,并截取输出

else echo "p" . mb_strimwidth(strip_tags(apply_filters('the_content', $post-post_content)), 0, 290,"..."). "/p";?

/div

?php else :?

div class="post-content"

?php if(has_excerpt()) the_excerpt(); //判断是否存在手动摘要,并完整输出

else echo "p" . mb_strimwidth(strip_tags(apply_filters('the_content', $post-post_content)), 0, 460,"..."). "/p";?

/div

?php endif;?

# code from :

里面的css样式ID根据自己的来调整。

如何实现WordPress 首页不显示文章全文

方法一:

就在编辑文章的上面,找到“插入‘More’标签(Alt+Shift+T)”你想首页显示那一段,就在那段后面加上这个,方法很简单,就是每次编辑文章不能忘记按了。

方法二:

在你主题文件夹下面的index.php页面,找到一段类似

?php the_content(__('More gt;gt;')); ?

的代码,如果找不到,Ctrl+F找

php the_content

一般只会有一句这个代码,这一排代码就是输出整篇文章内容的。换成:

?php

if(has_excerpt())

{the_excerpt();?

a rel="more-link" href="?php the_permalink() ?"  title="?php the_title(); ?"gt;gt;阅读全文lt;lt;/a

?php }

else {

echo mb_strimwidth(strip_tags(apply_filters('the_content', $post-post_content)), 0, 500,"......"); ?

a rel="more-link" href="?php the_permalink() ?"  title="?php the_title(); ?"gt;gt;阅读全文lt;lt;/a

?php }//end else ?

简单的解释下这段代码有什么用。

如果你不写编辑框下面的摘要,首页只显示文章的500个文字。如果你写了摘要,首页只显示摘要里面的内容。是不是很人性化呢?

效果看看我的首页就知道啦~~~


当前名称:wordpress全文 wordpress全文检索方案
当前网址:http://bjjierui.cn/article/dddssdo.html

其他资讯