Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Truncating Headlines by words count in Schema Plugin
<?php //* do not include php tag
add_filter('schema_wp_filter_headline', 'truncating_headlines_words_567545256');
* Schema Plugin: Truncating Headlines by words count
* @since 1.0
function truncating_headlines_words_567545256( $headline ) {
$word_count = 6; // number of words
$short_headline = wp_trim_words( $headline, $word_count, '' );
return $short_headline;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.