Created
January 17, 2018 16:48
-
-
Save mbrughi/32ee2abaf0ccb4db431c6349cc51ec23 to your computer and use it in GitHub Desktop.
Wordpress: limit title lenght.
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 max_title_length( $title ) { | |
$max = 20; | |
if( strlen( $title ) > $max ) { | |
return substr( $title, 0, $max ). " …"; | |
} else { | |
return $title; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment