Created
July 14, 2018 11:34
-
-
Save schemapress/a355ad4a0b66f8a28ecb453cf4d0e1cb to your computer and use it in GitHub Desktop.
Truncating Headlines by characters 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_chars_567545256'); | |
/** | |
* Schema Plugin: Truncating Headlines by characters count | |
* | |
* @since 1.0 | |
*/ | |
function truncating_headlines_chars_567545256( $headline ) { | |
$char_count = 110; // number of characters | |
$short_headline = mb_strimwidth( $headline , 0, $char_count, ''); | |
return $short_headline; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment