Show Read More button on Astra on Custom Excerpt

a guest Feb 14th, 2020 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Append ellipses to excerpts and then show "Read More"  button for manual & automatic excerpts.
  2. * @param type $text
  3. * @return string
  4. */
  5. function custom_excerpt($text) {
  6. // $text= substr_replace($text,"...",strpos($text, "</p>"),0);
  7. $excerpt = $text . '<a href="' . get_permalink() . '"><button class="read-more-btn" type="button" value="read_more">Read More</button></a>';
  8. return $excerpt;
  9. }
  10. add_filter('the_excerpt', 'custom_excerpt');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand