Skip to content

Instantly share code, notes, and snippets.

@wilsonwc
Created December 21, 2012 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilsonwc/4351258 to your computer and use it in GitHub Desktop.
Save wilsonwc/4351258 to your computer and use it in GitHub Desktop.
Wordpress shortcode for simply setting font size and color usage: [font size="20px" color="#333"]Some text[/font]
<?php
function font_shortcode( $atts, $content = null ) {
extract(shortcode_atts(array(
'size' => '',
'color' => '',
), $atts));
$size = ($size) ? ' font-size:'.$size : '';
$color = ($color) ? ' color:'.$color : '';
$out = '<span' .$target. ' style="' .$size.$color. '">' .do_shortcode($content). '</span>';
return $out;
}
add_shortcode('font', 'font_shortcode');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment