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中
.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繼續閱讀網址的 #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
發表評論
想要留言嗎?歡迎歡迎!