Created
January 9, 2025 08:15
-
-
Save benpearson/ee822829a95e2d94dcc7d9f98380616a to your computer and use it in GitHub Desktop.
WordPress: Excerpt helpers
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
function dt_custom_excerpt_length($length) | |
{ | |
global $post; | |
if ($post->post_type == 'post') { | |
return 18; // words | |
} | |
} | |
// add_filter( 'excerpt_length', 'dt_custom_excerpt_length', 999 ); | |
function dt_custom_excerpt_more($more) | |
{ | |
global $post; | |
if ($post->post_type == 'post') { | |
return '...'; | |
} | |
} | |
// add_filter( 'excerpt_more', 'dt_custom_excerpt_more' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment