Skip to content

Instantly share code, notes, and snippets.

@mansam
Last active October 17, 2017 03:50
Show Gist options
  • Save mansam/f473f1375309a721b60d8d6d96a6cef5 to your computer and use it in GitHub Desktop.
Save mansam/f473f1375309a721b60d8d6d96a6cef5 to your computer and use it in GitHub Desktop.
<?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;">&lt;' . $titlecased_content . '&gt;</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