Skip to content

Instantly share code, notes, and snippets.

@3200creative
Last active March 28, 2019 17:52
Show Gist options
  • Save 3200creative/b45a4980d6c2a505d3f3 to your computer and use it in GitHub Desktop.
Save 3200creative/b45a4980d6c2a505d3f3 to your computer and use it in GitHub Desktop.
Fontawesome Shortcode For WordPress
// Icon Shortcode Using Fontawesome by 3200creative
// to use this shortcode use the following markup [fa-icon id="option-id" class="custom-class" type="arrow" size="24" color="#ff9900"]
function icon_func( $atts ) {
$a = shortcode_atts( array(
'type' => 'Add Icon Type',
//ID is optional
'id' => '',
'size' => 'Add Size',
'color' => 'Add Color',
'class' => 'Add Class',
), $atts );
return '<span id="'."{$a['id']}".'" style="font-size:'."{$a['size']}".'px; color:'."{$a['color']}".';"class="fa fa-'."{$a['type']}".' '."{$a['class']}".'"></span>';
}
add_shortcode( 'fa-icon', 'icon_func' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment