There is no conditional tag, but there is a filter. If you hook into the 'get_the_excerpt'
filter, your function will run. So, as an example:
if(is_archive() || is_category()){
add_filter( 'get_the_excerpt', 'my_custom_excerpt_filter' );
}
function my_custom_excerpt_filter( $excerpt ){
if( !defined( 'USED_EXCERPT' ) ){
define( 'USED_EXCERPT', true );
}
}
Then, to check whether an excerpt was used, any time after the first iteration of the loop, use this:
if(defined('USED_EXCERPT') && USED_EXCERPT){
//If the excerpt was used, this if statement returns true.
}
This isn't a very elegant or useful way of doing it, but this is how you would do it. If you need to know whether a template will use the excerpt before it loads the template, you'd have to hook this earlier, use fopen()
to read through the template file and search for the_excerpt()
.