If you look into the function comments_popup_link()
you will see the following code at the end:
$title = the_title_attribute( array('echo' => 0 ) );
echo apply_filters( 'comments_popup_link_attributes', '' );
echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
comments_number( $zero, $one, $more );
echo '</a>'; // last line
Note the call to __()
, the translation function. We can filter 'gettext'
to change the result. Since we do not want to run our filter on every translation – that would be too slow – we start the filter when the hook 'comments_popup_link_attributes'
is called:
add_filter( 'comments_popup_link_attributes', 't5_cclta_init' );
function t5_cclta_init( $attrs )
{
add_filter( 'gettext', 't5_cclta_change_title', 10, 3 );
return $attrs;
}
Now we need just the real filter function:
function t5_cclta_change_title( $translated, $text, $domain )
{
remove_filter( current_filter(), __FUNCTION__, 10 );
if ( 'default' === $domain && 'Comment on %s' === $text )
return 'Talk about %s';
return $translated;
}
And now the title attribute says: Talk about The Post Title.