Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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