Last active
July 15, 2016 00:04
-
-
Save davidvandenbor/a90c776e14e50f60db8e3f62c9c879b3 to your computer and use it in GitHub Desktop.
WP custom excerpt lenght for global use
This file contains hidden or 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
<?php | |
/** | |
* @author @david | |
* Wordpress excerpt lenght for global use, with automatic "read more" | |
* | |
*/ | |
function et_excerpt_length($length) { | |
return 120; | |
} | |
add_filter('excerpt_length', 'et_excerpt_length'); | |
/* Add a link to the end of our excerpt contained in a div for styling purposes and to break to a new line on the page.*/ | |
function et_excerpt_more($more) { | |
global $post; | |
return '<div class="text-right"><a href="'. get_permalink($post->ID) . '" class="button small">Lees verder</a></div>'; | |
} | |
add_filter('excerpt_more', 'et_excerpt_more'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment