Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Excerpts

Replace the similar part with it in front-page.php (Kakumei):

<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
<tr<?php topic_class(); ?>>
<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a>
<?php
// from wp_trim_excerpt() in WordPress 2.3.1 formatting.php, just removed few lines
function make_excerpt($text) { // Fakes an excerpt if needed
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = 55;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, '[...]');
$text = implode(' ', $words);
}
return $text;
}

echo make_excerpt( get_post_text( $topic->topic_last_post_id ) );
?>
</td>
<td class="num"><?php topic_posts(); ?></td>
<td class="num"><?php topic_last_poster(); ?></td>
<td class="num"><small><?php topic_time(); ?></small></td>
</tr>
<?php endforeach; endif; // $topics ?>

It generates an excerpt of latest reply of topic.

Skip to toolbar