Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Increase the size of generated excerpts in the Theater for WordPress plugin to 50 characters.
<?php
/*
* Increase the size of generated excerpts to 50 characters.
* @param string $excerpt The current excerpt.
* @param WPT_Production $production The production.
* @return string The updated excerpt.
*/
function wpt_excerpt_long($excerpt, $production) {
$excerpt = $production->post()->post_excerpt;
if (empty($excerpt)) {
$excerpt = wp_trim_words(strip_shortcodes($production->post()->post_content), 50);
}
return $excerpt;
}
add_filter('wpt_production_excerpt', 'wpt_excerpt_long', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment