• Resolved haiderkb

    (@haiderkb)


    Hi
    Would it be possible to have an option to limit the number of words showing from the excerpt? I need the longer Excerpt for other areas of my site, but would be good to limit it in this Widget if possible. I know one or two others do do it and am looking at using them, but yours has been quite reliable so was wondering.

    Thanks

    Haider

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author mrwweb

    (@mrwweb)

    It’s unlikely I’ll add this as an option, but it’s easy to do via one of the filters in the plugin!

    add_filter( 'fpw_excerpt', 'wp8887975_trim_fpw_excerpt' );
    function wp8887975_trim_fpw_excerpt( $excerpt ) {
    	$excerpt = wp_trim_words( $excerpt, 30, '…' );
    	return $excerpt;
    }

    That trims the widget excerpt to 30 words and appends a “…” to the end of any excerpt that gets trimmed (the '…'). Adjust as needed ??

    Thread Starter haiderkb

    (@haiderkb)

    Thanks. So where do I put this?

    and if so simple, why not just add it. It really is a very useful addition.

    Haider

    Plugin Author mrwweb

    (@mrwweb)

    If you use a custom child theme or custom theme, you can put it in your functions.php file.

    Creating a custom /mu-plugin/ is probably the best option. Here’s a gist showing that: https://gist.github.com/mrwweb/0235f18da595eca8351e7c51512d274d

    This plugin is as easy-to-use as it is because it doesn’t include tons of options and variations ??

    Thread Starter haiderkb

    (@haiderkb)

    Thank you.I appreciate your approach. Fully understood.

    To be honest I cannot imagine wanting any other option.

    I will look into having it in my custom theme.

    BR
    Haider

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Excerpt limit just for this widget’ is closed to new replies.