Last active
October 17, 2017 03:50
-
-
Save mansam/f473f1375309a721b60d8d6d96a6cef5 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
<?php | |
function keyword_shortcode($atts, $content = null) { | |
$custom_factions = array("Chapter", "Legion", "Regiment", "Craftworld", "Masque", "Clan", "Order", "Sept", "Hive Fleet", "Dynasty", "Kabal", "Haemonculus Coven", "Wych Cult", "Ordo"); | |
if (!empty($content)) { | |
$titlecased_content = ucwords(strtolower($content)); | |
if (in_array($titlecased_content, $custom_factions)) { | |
return '<span style="font-variant: small-caps; font-weight: bold;"><' . $titlecased_content . '></span>'; | |
} else { | |
return '<span style="font-variant: small-caps; font-weight: bold;">' . $titlecased_content . '</span>'; | |
} | |
} else { | |
return ''; | |
} | |
} | |
add_shortcode('kw', 'keyword_shortcode'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment