将摘录与函数中的自定义“阅读更多”链接一起使用。php
add_filter( \'excerpt_length\', \'modify_excerpt_length\' );
function modify_excerpt_length( $length ) {
return 15;
}
add_filter( \'excerpt_more\', \'your_excerpt_more\' );
function your_excerpt_more( $more ) {
$more = sprintf( \' <a href="%s" class="read-more" rel="bookmark">\' . __( \'Read More\' ) . \'</a>\', esc_url( get_permalink() ) );
return $more;
}
或者,您可以按如下方式筛选\\u摘录或获取\\u摘录挂钩:
add_filter( \'get_the_excerpt\', \'link_read_more\' );
function link_read_more( $output ) {
$more = sprintf( \' <a href="%s" class="read-more" rel="bookmark">\' . __( \'Read More\' ) . \'</a>\', esc_url( get_permalink() ) );
return $output . $more;
}