Limit the_excerpt in the first point (.) of the sentence

First, please make sure you understand the difference between the_excerpt and the_content. You are asking about the_excerpt but I suspect that you might actually mean the_content. That said… You can filter the the_excerpt function with a filter of the same name. add_filter( ‘the_excerpt’, function ($excerpt) { return substr($excerpt,0,strpos($excerpt,’.’)+1); } );

Stop strip_shortcodes() stripping content inside shortcodes

Try the filters in your functions.php: add_filter( ‘the_excerpt’, ‘shortcode_unautop’); add_filter( ‘the_excerpt’, ‘do_shortcode’); Props: @bainternet (Source) Or, use your own filter on get_the_excerpt. Put this in your theme’s functions.php: function custom_excerpt($text=””) { $raw_excerpt = $text; if ( ” == $text ) { $text = get_the_content(”); // $text = strip_shortcodes( $text ); $text = do_shortcode( $text ); … Read more

the_excerpt() or get_the_excerpt with shortcode escape

You can make WordPress execute your shortcode in the excerpt by hooking into get_the_excerpt filter and overwriting the default wp_trim_excerpt function, which is responsible of stripping the shortcode tags from the excerpt as pointed by Chip: add_filter(‘get_the_excerpt’, ‘do_my_shortcode_in_excerpt’); function do_my_shortcode_in_excerpt($excerpt) { return do_shortcode(wp_trim_words(get_the_content(), 55)); } This is applied to both the_excerpt() and get_the_excerpt() outputs. If … Read more

How to get post or page excerpt using post_excerpt

EDIT Seems that I some how misunderstood you. I do think you are missing the point of the post_excerpt. When you create a new post or page (AFAIK for pages as well), you have the opportunity to create a manual excerpt in the excerpt meta box (to make it available, just enable it in screen … Read more

How to return the_excerpt (without echo)?

Sure thing my friend, you see, the function “the_excerpt” (located at “WORDPRESSINSTALLDIR/wp-includes/post-template.php”) is the one that makes the echo: function the_excerpt() { echo apply_filters(‘the_excerpt’, get_the_excerpt()); } so, what you want is to use the same function “apply_filters” without the echo: $myexcerpt = apply_filters(‘the_excerpt’, get_the_excerpt()); …and there you have your excerpt.

Excerpt Word Count

Sorry for reading wrong your question @siouxfan45! here is the right answer: just a little improvement in your code and you can count words! just change these two lines: jQuery(“#excerpt_counter”).val(jQuery(“#excerpt”).val().length); to this: jQuery(“#excerpt_counter”).val(jQuery(“#excerpt”).val().split(/\S\b[\s,\.\’-:;]*/).length – 1); Words with single quote like “don’t”, “it’s”, “I’d”, “won’t”…will count as two! If you want them to count as a … Read more

How to use the_excerpt in a filter hook?

use the filter get_the_excerpt. Look at line no. 250 here, they are using the_excerpt internally on the function get_the_excerpt(), and in this function on line no. 272, they’re applying the filter get_the_excerpt on the actual excerpt. Hence, add_filter(‘get_the_excerpt’, ‘exc’); function exc($param) { return “Whew !”.$param; } is the way to go if you want to … Read more

Custom excerpt length on home page

How filters work Filters are simply a point where you can take some value, that is set (for something) in core (for e.g. the the_excerpt() function), in open to modifications. So… $some_var = apply_filters( ‘change_this_var’, 50 ); …just says: »Some var« is set to 50, but when you add a filter callback to change_this_var, then … Read more