3

I would like to filter the function the_excerpt to stop to find the first endpoint.

Ex: "This is the article summary which ends at the endpoint with a full-stop."

Any idea is welcome.

2
  • Not sure if this is a duplicate, but read this should be useful
    – gmazzap
    Sep 13, 2013 at 1:38
  • Thank you for having edited @Mayeenul Islam. By Google translator may not have expressed in the best way.
    – BobGCA2
    Sep 13, 2013 at 13:53

1 Answer 1

4

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);
  }
);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.