How To Create Custom WordPress Excerpt Length
1 2 3 4 5 6 7 |
// CUSTOM EXCERPT LENGTH function excerpt($limit) { return wp_trim_words(get_the_excerpt(), $limit, custom_read_more()); } function custom_read_more() { return ' <span><a href="'. get_permalink() .'" title="Read the full story" class="excerptlink">[...] Read the full story</a></span>'; } |
Place the PHP snippet below in your theme template and the excerpt will be limited to 36 characters.
1 |
<?php echo excerpt(36); ?> |