Step 1: Copy and paste the following code into your functions.php file.
File: functions.php
-------------------
// Icon Shortcode Using Icomoon.io by 3200creative
// to use this shortcode use the following markup [fa-icon id="optional" 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',
), $atts );
return '<span id="'."{$a['id']}".'" style="font-size:'."{$a['size']}".'px; color:'."{$a['color']}".';"class="fa fa-'."{$a['type']}".'"></span>';
}
add_shortcode( 'fa-icon', 'icon_func' );
Step 2: Paste the following shortcode into your post, page, or widget:
[fa-icon id=”optional” type=”arrows” size=”24″ color=”#ff9900″]
Example:
[fa-icon id=”optional” type=”arrows” size=”24″ color=”#ff9900″] [fa-icon id=”optional” type=”arrows” size=”44″ color=”rgb(46, 171, 226)”]
Shortcode fields:
id: Use this for a specific ID for the icon.
type: Head over to fontawesome and locate the icon you’d like to use. Paste the simple name of it here to display that icon.
type: Font size of the icon.
color: Hex or RGBa color of the icon.
Leave a Reply
You must be logged in to post a comment.