Created
April 11, 2020 02:17
-
-
Save tiendungdev/af6bd87f9e0d1d1eb7b2b3ba3879d2e5 to your computer and use it in GitHub Desktop.
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
/** | |
* Multi excerpt_length | |
*/ | |
function vts_variable_excerpt_length( $length ) { | |
global $post; | |
if ( 'post' === $post->post_type ) { | |
return 32; | |
} else if ( 'page' === $post->post_type ) { | |
return 65; | |
} else if ( 'products' === $post->post_type ) { | |
return 75; | |
} else { | |
return 80; | |
} | |
} | |
add_filter( 'excerpt_length', 'vts_variable_excerpt_length'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment