Skip to content

Instantly share code, notes, and snippets.

@EastSideCode
Created May 3, 2018 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EastSideCode/66c0ff29ba3f948c4d0eb248de44b80f to your computer and use it in GitHub Desktop.
Save EastSideCode/66c0ff29ba3f948c4d0eb248de44b80f to your computer and use it in GitHub Desktop.
Edit WordPress excerpts
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '... <a class="read-more-link" href="'. get_permalink($post->ID) . '">Read More</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
// change excerpt length
function custom_excerpt_length( $length ) {
return 39;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment