首先,到wordpress后臺(tái),依次選擇 外觀--編輯--選擇右邊的index.php文件,在里面可以看到語(yǔ)句
成都創(chuàng)新互聯(lián)公司"三網(wǎng)合一"的企業(yè)建站思路。企業(yè)可建設(shè)擁有電腦版、微信版、手機(jī)版的企業(yè)網(wǎng)站。實(shí)現(xiàn)跨屏營(yíng)銷,產(chǎn)品發(fā)布一步更新,電腦網(wǎng)絡(luò)+移動(dòng)網(wǎng)絡(luò)一網(wǎng)打盡,滿足企業(yè)的營(yíng)銷需求!成都創(chuàng)新互聯(lián)公司具備承接各種類型的成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、外貿(mào)網(wǎng)站建設(shè)項(xiàng)目的能力。經(jīng)過(guò)十載的努力的開(kāi)拓,為不同行業(yè)的企事業(yè)單位提供了優(yōu)質(zhì)的服務(wù),并獲得了客戶的一致好評(píng)。
?php while ( have_posts() ) : the_post(); ?
?php get_template_part( 'content', get_post_format() ); ?
?php endwhile; ?
其次可以看出,index.php是嵌套一個(gè) content.php 的文件用于專門顯示文章的內(nèi)容,這就是為什么在首頁(yè)老是顯示文章全文。那么,打開(kāi)content.php文件找到
?php
the_content( __( 'Continue reading span→/span', 'twentyeleven' ) );
?
將它修改為
?php if(!is_single()) {
the_excerpt();
} else {
the_content(__('(more…)'));
} ?
最后,保存,就顯示摘要了。
直接在寫(xiě)文章的時(shí)候添加手動(dòng)摘要就行,如果還是不行,就用
?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";//判斷是否存在手動(dòng)摘要,并截取輸出
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();?//判斷是否存在手動(dòng)摘要,并完整輸出
else?echo?"p"?.?mb_strimwidth(strip_tags(apply_filters('the_content',?$post-post_content)),?0,?460,"...").?"/p";?
/div
?php?endif;?
#?code?from?:
里面的css樣式ID根據(jù)自己的來(lái)調(diào)整。
方法一:
就在編輯文章的上面,找到“插入‘More’標(biāo)簽(Alt+Shift+T)”你想首頁(yè)顯示那一段,就在那段后面加上這個(gè),方法很簡(jiǎn)單,就是每次編輯文章不能忘記按了。
方法二:
在你主題文件夾下面的index.php頁(yè)面,找到一段類似
?php?the_content(__('More?gt;gt;'));??
的代碼,如果找不到,Ctrl+F找
php?the_content
一般只會(huì)有一句這個(gè)代碼,這一排代碼就是輸出整篇文章內(nèi)容的。換成:
?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??
簡(jiǎn)單的解釋下這段代碼有什么用。
如果你不寫(xiě)編輯框下面的摘要,首頁(yè)只顯示文章的500個(gè)文字。如果你寫(xiě)了摘要,首頁(yè)只顯示摘要里面的內(nèi)容。是不是很人性化呢?
效果看看我的首頁(yè)就知道啦~~~
本文名稱:wordpress全文 wordpress全文檢索方案
URL鏈接:http://www.chinadenli.net/article10/dddssdo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開(kāi)發(fā)、虛擬主機(jī)、做網(wǎng)站、面包屑導(dǎo)航、營(yíng)銷型網(wǎng)站建設(shè)、全網(wǎng)營(yíng)銷推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)