Created
January 31, 2023 00:13
-
-
Save jackfearing/c595d4681a2aa606f662e73c09d7a458 to your computer and use it in GitHub Desktop.
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
| //Display short blog title in WordPress | |
| //There is a simple script you can use to implement a short blog title without modifying the base WordPresscode. Open up your functions.php file within your theme and add the following: | |
| function short_title() { | |
| $title = get_the_title(); | |
| $count = strlen($title); | |
| if ($count >= 25) { | |
| $title = substr($title, 0, 25); | |
| $title .= '...'; | |
| } | |
| echo $title; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment