Hey guys, is there a way to decrease/increase content excerpt in the Post module? Ideally, I would like to be able to change that limit per module.
Thanks,
Viktor
Hey guys, is there a way to decrease/increase content excerpt in the Post module? Ideally, I would like to be able to change that limit per module.
Thanks,
Viktor
Hi Viktor,
Unfortunately, this isn’t possible using the Post module. The only way to achieve this would be through either custom code to control the excerpt length and use conditional tags.
https://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length
https://developer.wordpress.org/themes/basics/conditional-tags/
Alternatively, you could maybe try this plugin (untested).
Thanks,
Danny
Thanks Danny. Would be great to see a simple text input for Posts module to allow us to set custom excerpt length, and/or switch between actual excerpt or the_content cut off at a specified mark.
Hi Viktor,
It’s a great idea. If you have time, post this idea to our UserVoice and I will be sure to bring it to their attention.
https://wpbeaverbuilder.uservoice.com/forums/270594-general
Thanks,
Danny
I ran couple of tests, and this seems to work fine with conditional check:
function custom_excerpt_length( $length ) {
if(is_home() || is_front_page()){
return 20;
}else{
return 50;
}
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
In case anyone else needs this.
Awesome Viktor and thanks for sharing! I’m sure some of our users will find this useful.
Thanks,
Danny