So far, I've been able to only consistently hook the_content, appending my plugin at the end. How can I test if the displayed article is not the_content, but an excerpt, and hook my plugin after every the_excerpt?
1 Answer
From the codex there are a couple of possible filters for you to try:
- get_the_excerpt
- the_excerpt - look at @Mayeenul's link for usage suggestions
Personally I would try the first one with something like:
function fileterExcerpt($excerpt){
if(has_excerpt()){
$excerpt .= "Some extra text";
}
return $excerpt;
}
add_filter( 'get_the_excerpt', 'filterExcerpt' );
Hope this helps.