I am aware of creating a shortcode this way:
function font_fam($atts, $content = null){
extract(shortcode_atts(array(
'f' => '',
), $atts ));
return '<span style="font-family:'.$f.'">'.$content.'</span>';
}
add_shortcode ('f','font_fam');
And to use it would be like this right:
[f f="Arial"] Text Text [/f]
But is there a way so that it will be used like this:
[f Arial] Text Text[/f]
[f Tahoma] Text Text [/f]
(skipping the “f=”)
Thanks!
Try this:
One way could be to preparse your content by hooking a ‘the_content’ filter that adds the
f=
bit.Another could be to change your shortcodes to something like
[Tahoma]...[/Tahoma]
and skip the f altogether, although then you end up registering a lot of shortcodes.