Here’s a starting point.
function new_excerpt_more($post) {return '<span class="more-excerpt"><a class="more-link-excerpt" href="'. get_permalink($post->ID) . '">' . '[...]' . '</a></span>';}
add_filter('excerpt_more', 'new_excerpt_more');
/*
Changes [...] after the default excerpt but NOT when you manually enter an excerpt into the excerpt box beneath a post (currently anything entered into the excerpt box is displayed without being followed by [...] )
http://codex.wordpress.org/Template_Tags/the_excerpt
*/
Thanks richarduk! I’ve seen that but my problem is, I need it to be custom. I don’t want the other excerpts I’m using picking that up as well. Does that make sense?
How about surrounding it with a conditional? If is category 5, if is single etc.
That may work but a co-worker and I created some PHP magic with the following:
<?php
$content = $post->post_content;
$content = strip_shortcodes($content);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
$excerpt_length = 35;
$words = explode(' ', $content, $excerpt_length + 1);
if(count($words) > $excerpt_length) :
array_pop($words);
array_push($words, '…');
$content = implode(' ', $words);
endif;
echo $content;
?> <a href="<?php the_permalink(); ?>">Read and Comment (<?php echo comments_number('0', '1', '%'); ?>)</a>
It works for what I need and may well work for others too. This isn’t in the functions.php file but like I said, it works.