Just add the filter where you need it.
Define the filter callback in functions.php
but don’t add the filter…
// Changing excerpt more
function new_excerpt_more($post) {
return ' <a class="read_more" href="'. get_permalink($post->ID) . '">' . 'read more' . '</a>';
}
In your template file just before you need the custom more link:
add_filter('excerpt_more', 'new_excerpt_more');
And remove it afterwards
remove_filter('excerpt_more', 'new_excerpt_more');
Or make it self-removing…
function new_excerpt_more($post) {
remove_filter('excerpt_more', 'new_excerpt_more');
return ' <a class="read_more" href="'. get_permalink($post->ID) . '">' . 'read more' . '</a>';
}