Created
December 21, 2012 07:37
-
-
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]
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 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