谢谢你的帮助!
功能。php
function excerpt($limit) {
$excerpt = explode(\' \', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt);
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace(\'`[[^]]*]`\',\'\',$excerpt);
return $excerpt;
}
索引。php
<div class="post excerpt <?php echo (++$j % 2 == 0) ? \'last\' : \'\'; ?>">