Set Excerpt to Characters, Not Words
-
I need every post excerpt to be the same length and include “…read more” at the end. I have tried every function I could find to make it generate the first x number of characters instead of words but none have been successful. Here is the code I currently have in functions.php
// Excerpt Length Control function set_excerpt_length(){ return 44; } add_filter('excerpt_length', 'set_excerpt_length'); function new_excerpt_more( $more ) { return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . __('...Read More', 'your-text-domain') . '</a>'; } add_filter( 'excerpt_more', 'new_excerpt_more' );
The current code works exactly how I need it to, but can I set it to pull characters instead of words?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Set Excerpt to Characters, Not Words’ is closed to new replies.