Display only manual excerpt on index (function).
-
This is my current functions.php custom function:
function custom_excerpt($text) { // custom 'read more' link if (strpos($text, '[...]')) { $excerpt = strip_tags(str_replace('[...]', '<div class="readmore"><a class="readmore" href="'. get_permalink( get_the_ID() ) . '"><small>CONTINUE READING</small></a></div>', $text), "<a>"); } else { $excerpt = '' . strip_tags($text) . '<div class="readmore"><a class="readmore" href="'. get_permalink( get_the_ID() ) . '"><small>CONTINUE READING</small></a></div>'; } return $excerpt; } add_filter('the_excerpt', 'custom_excerpt');
You can see it in action here: https://ohmybonbon.com.
I would like to see only the manual excerpts displayed, and if there is no manual excerpt, I would like it to only display the ‘continue reading’ link, rather than an automatic excerpt (as it is currently doing).
I’m sure this is probably incredibly easy, but my brain isn’t working. So, of course, help is greatly appreciated!
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Display only manual excerpt on index (function).’ is closed to new replies.