WordPress 繼續閱讀的相關問題

有些佈景會遇到繼續閱讀變成[...]或是沒有顯示繼續閱讀的問題,可參考以下方式解決

把繼續閱讀顯示[...]改為...

// Replace the default ellipsis
function trim_excerpt($text) {
$text = str_replace('[…]', '...', $text);
return $text;
}
add_filter('get_the_excerpt', 'trim_excerpt');

在php中文章處增加以下語法
<?php the_content( $more_link_text , $strip_teaser ); ?>

你可以變更繼續閱讀的顯示方式

以下是此部落格使用的css,請加在style.css中

Wordpress 繼續閱讀的相關問題

.more-link{
background: url(http://img.photobucket.com/albums/v333/dorigo/more_zps6111dcbf.png) no-repeat scroll right bottom transparent;
color: rgb(140, 156, 156);
display: block;
text-shadow: 2px 2px 2px rgb(255, 255, 255);
padding-right: 10px;
padding-left: 10px;
text-decoration: none;
height: 35px;
line-height: 35px;
margin-left: 10%;
margin-right: 10%;
text-align: center;float: right;
margin-left: 0px;
margin-right: 0px;
}

繼續閱讀的網址會加上#more,若是貼此網址分享時並不會從文章的最上面顯示,而是會從繼續閱讀以下的內容開始顯示

Wordpress 繼續閱讀的相關問題
Wordpress 繼續閱讀的相關問題

//移除WordPress繼續閱讀網址的 #more
function remove_more_link_scroll( $link ) {
$link = preg_replace( '|#more-[0-9]+|', '', $link );
return $link;
}
add_filter( 'the_content_more_link', 'remove_more_link_scroll' );

 

更多用法可參考:http://codex.wordpress.org/Customizing_the_Read_More

關於作者 多力哥
Wordpress 繼續閱讀的相關問題
影像創作攝影師/網頁動畫設計師/系統網路工程師/水草研究生
景文科大畢業後,我成為一名網站動畫設計師,並副修MIS電腦資訊管理。2004年,我開始接觸單眼相機,並在2008年正式成為一名接案攝影師,目前使用Canon系統進行拍攝。2016年,我愛上了美麗的水草缸,這讓我的生活多了另一層次的放鬆。每天在電腦前修圖時,能欣賞紅吱吱、綠油油的水草,彷彿多了一份平靜與愉悅。攝影與水草讓我的生活充滿了藝術與自然的交融。
連絡信箱:hello@hahasmile.com (歡迎合作提案)
DORIGO IMAGE 攝影工作室:https://dorigo-image.com
如果你喜歡我的內容,可以用行動贊助我一杯咖啡☕,支持我持續創作,也讓這個網站可以繼續營運下去喔!

若您喜歡這篇文章,歡迎按讚分享喔!
0 回復

發表評論

想要留言嗎?
歡迎歡迎!

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *