Last active
March 28, 2019 17:52
-
-
Save 3200creative/b45a4980d6c2a505d3f3 to your computer and use it in GitHub Desktop.
Fontawesome Shortcode For WordPress
This file contains hidden or 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
// 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