Created
February 6, 2018 11:59
-
-
Save richardprice-1990/9be705fcb10f20a8eccfee423275e16d 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
//orignal | |
function spanify_title($title) { | |
$title_words = explode(' ', $title); | |
if (count($title_words) > 1) { | |
$title_words[1] = '<span>' . $title_words[1] . '</span>'; | |
return implode(' ', $title_words); | |
} else { | |
return $title; | |
} | |
} | |
//new | |
function spanify_title($title) { | |
$title_words = explode(' ', $title, 2); | |
if (count($title_words) > 1) { | |
$title_words[1] = '<span>' . $title_words[1] . '</span>'; | |
return implode(' ', $title_words); | |
} else { | |
return $title; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment