Truncating Headlines by words count in Schema Plugin https://schema.press/docs/truncating-headlines/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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