Change Featured page widget text length

Featured page widget can be used in the majority of our themes: BuildPress, MentalPress, CargoPress, LegalPress and all newer themes. In each theme, the widget has a slightly different design, but it always has the text block.

Feauted Page Widget Text

To change the Featured page widget text length you will have to change some code in the theme. Let’s take a look at how to change the length of the text in each theme.

BuildPress

Edit the file: inc/widgets/widget-featured-page.php and find these two lines and change the values to your liking:

const INLINE_EXCERPT = 60;
const BLOCK_EXCERPT = 240;

MentalPress

In this theme, you will have to edit the numbers in the ProteusWidgets plugin. Edit the file: wp-content/plugins/proteuswidgets/widget-featured-page.php and change these values to your liking:

const INLINE_EXCERPT = 60;
const BLOCK_EXCERPT = 240;

CargoPress, LegalPress, RepairPress, StructurePress and all newer themes

Paste this code at the end of your functions.php file and change the lengths to your liking:

function custom_featured_page_widget_excerpt_lengths( $excerpt_lengths ) {
  $excerpt_lengths['inline_excerpt'] = 60;
  $excerpt_lengths['block_excerpt'] = 240;
  return $excerpt_lengths;
}
add_filter( 'pw/featured_page_excerpt_lengths', 'custom_featured_page_widget_excerpt_lengths', 30 );

Note: when you update the theme, these changes will get overwritten.

If you’re looking for a way to change the featured images sizes displayed by the Featured Page widget, we have a guide for that as well.