Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bodhi1970

    (@bodhi1970)

    Tried with adding some piece of code in the php, but it does not work

    public function aw_FASC_shortcode($params) {
    		extract(shortcode_atts(array(
    					'icon' => 'exclamation',
    					'size' => '',
    				), $params));
    
    		if(substr($icon, 0, 3) != "fa-") {
    			$icon = "fa-".$icon;
    		}
    
    		// Resizing
            $size = "fa-";
            if ( !empty($shortcode_atts['size']) && isset($shortcode_atts['size']) && in_array($shortcode_atts['size'], array('2x', '3x', '4x', '5x', '6x')) ) {
                $size .= $shortcode_atts['size'];
            }
            else {
                $size .= "1x";
            }
    
            return '<i class="fa '.$icon.' '.$size.'"></i>';
    	}
    Thread Starter bodhi1970

    (@bodhi1970)

    The code above I copied from the genericon plugin but it is much easier.
    It works like this

    public function aw_FASC_shortcode($params) {
    		extract(shortcode_atts(array('icon' => 'exclamation','size' => 'exclamation',), $params));
    
    		if(substr($icon, 0, 3) != "fa-") {
    			$icon = "fa-".$icon;
    		}
    
    		// Resizing
            if(substr($size, 0, 3) != "fa-") {
    			$size = "fa-".$size;
    		}
    
            else {
                $size .= "1x";
            }
    
            return '<i class="fa '.$icon.' '.$size.'"></i>';
    	}
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Size’ is closed to new replies.