尝试替换此:
<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( \'content\', ( post_type_supports( get_post_type(), \'post-formats\' ) ? get_post_format() : get_post_type() ) );
?>
使用此选项:
<?php echo my_excerpt(get_the_ID(), 300, \'Read More\'); ?>
然后将其添加到函数中。php文件:
function my_excerpt($postid, $len = 500, $more = false) {
$excerpt = apply_filters(\'the_excerpt\', get_post_field(\'post_excerpt\', $postid));
if(empty($excerpt)) $excerpt = strip_shortcodes(strip_tags(apply_filters(\'the_excerpt\', get_post_field(\'post_content\', $postid))));
if(strlen($excerpt) > $len) $excerpt = substr($excerpt, 0, $len-3) . \'…\';
if($more) $excerpt .= \'<a class="read-more" href="\' . get_the_permalink($postid) . \'">\' . $more . \'</a>\';
return $excerpt;
}
默认情况下,将返回帖子内容的前300个字符。将my\\u摘录调用中的“300”更改为要返回的字符数(注意,这不是要返回的单词数,而是要返回的字符数)。