Last active
May 24, 2018 16:18
-
-
Save landbryo/0b1c77ed43aa16c80184ccf7a207762e to your computer and use it in GitHub Desktop.
Modifies WordPress excerpt via functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////// | |
// CUSTOM EXCERPT // | |
//////////////////// | |
function custom_excerpt_length( $length ) { | |
return 20; | |
} | |
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); | |
function custom_excerpt_more( $more ) { | |
return sprintf( '... <a class="bw-read-more" href="%1$s">%2$s</a>', | |
get_permalink( get_the_ID() ), | |
__( 'READ MORE »', 'textdomain' ) | |
); | |
} | |
add_filter( 'excerpt_more', 'custom_excerpt_more' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment