When displaying a FULL POST, break at the teaser ('<!--more-->') otherwise display the full post.
When displaying EXCERPTS
1) use a manual excerpt if it exists.
2) if a 'teaser' ('<!--more-->') shows up BEFORE the 'excerpt length' (as defined at ATO->Configure EXCERPTS->Excerpt length) is met, break the page at the <!--more-->.
3) otherwise, create a excerpt based on the ATO excerpt word count - after stripping out all HTML except the things specified in 'Don't strip these tags' - but those 'words' (a word being a string seperated by a blank) count as part of the word count. i.e. the HTML not stripped will be part of the word count.
edit functions.php and replace lines 276-325 which are
HTML Code:
// Custom Excerpts
function bfa_wp_trim_excerpt($text) { // Fakes an excerpt if needed
global $bfa_ata, $post;
if ( '' <> $text ) {
// an excerpt exists, just stick on the 'custom read more' and we're done
$words = preg_split("/\s+/", $text);
$custom_read_more = str_replace('%permalink%', get_permalink(), $bfa_ata['custom_read_more']);
$custom_read_more = str_replace('%title%', the_title('','',FALSE), $custom_read_more);
array_push($words, $custom_read_more);
$text = implode(' ', $words);
return $text;
}
$text = get_the_content('');
$words = preg_split ("/\s+/", $text);
$post_content = $post->post_content;
$post_content_length = count(preg_split("/\s+/", $post_content));
if (count($words) < $post_content_length) {
// use the teaser and its 'read more'
$bfa_ata_more_tag_final = str_replace("%post-title%", the_title('', '', false), $bfa_ata['more_tag']);
$text = the_content($bfa_ata_more_tag_final);
return $text;
} else {
// Build the excerpt from the post
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text, $bfa_ata['dont_strip_excerpts']);
$excerpt_length = $bfa_ata['excerpt_length'];
$words = preg_split("/\s+/", $text, $excerpt_length + 1);
// this is to handle the case where the number of words
// in the post equals the excerpt length
if ($post_content_length > $excerpt_length) {
array_pop($words);
array_pop($words);
$custom_read_more = str_replace('%permalink%', get_permalink(), $bfa_ata['custom_read_more']);
$custom_read_more = str_replace('%title%', the_title('','',FALSE), $custom_read_more);
array_push($words, $custom_read_more);
}
$text = implode(' ', $words);
return $text;
}
return $text;
}
HTML Code:
// Custom Excerpts function bfa_wp_trim_excerpt($text) { // Fakes an excerpt if needed global $bfa_ata, $post; if ( '' <> $text ) { // an manual excerpt exists, stick on the 'custom read more' and we're done $words = preg_split("/\s+/", $text); $custom_read_more = str_replace('%permalink%', get_permalink(), $bfa_ata['custom_read_more']); $custom_read_more = str_replace('%title%', the_title('','',FALSE), $custom_read_more); array_push($words, $custom_read_more); $text = implode(' ', $words); return $text; } $text = get_the_content(''); $words = preg_split ("/\s+/", $text); $post_content = $post->post_content; $post_content_length = count(preg_split("/\s+/", $post_content)); // Build the excerpt from the post $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); $text = strip_tags($text, $bfa_ata['dont_strip_excerpts']); $excerpt_length = $bfa_ata['excerpt_length']; $words = preg_split("/\s+/", $text, $excerpt_length + 1); // this is to handle the case where the number of words // in the post equals the excerpt length if ($post_content_length > $excerpt_length) { array_pop($words); // array_pop($words); $custom_read_more = str_replace('%permalink%', get_permalink(), $bfa_ata['custom_read_more']); $custom_read_more = str_replace('%title%', the_title('','',FALSE), $custom_read_more); array_push($words, $custom_read_more); } $text = implode(' ', $words); return $text; return $text; }
functions.php.zip