1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65:
<?php
$shortcodes_config['list_icons'] = array(
'no_preview' => true,
'options' => array(),
'child' => array(
'options' => array(
'icon' => array(
'name' => __('Icon', 'inbound-pro' ),
'desc' => __('Select the icon.', 'inbound-pro' ),
'type' => 'select',
'options' => $fontawesome,
'std' => 'none'
),
'content' => array(
'name' => __('List Content', 'leads'),
'desc' => __('Put the content here.', 'leads'),
'type' => 'textarea',
'std' => ''
)
),
'shortcode' => '[list icon="{{icon}}"]{{content}}[/list]',
'clone' => __('Add More List', 'cta' )
),
'shortcode' => '[list_icons]{{child}}[/list_icons]',
'popup_title' => __('Insert List Icons Shortcode', 'inbound-pro' )
);
add_shortcode('list_icons', 'inbound_shortcode_list_icons');
function inbound_shortcode_list_icons( $atts, $content = null ) {
extract(shortcode_atts(array(), $atts));
$out = '';
if (!preg_match_all("/(.?)\[(list)\b(.*?)(?:(\/))?\](?:(.+?)\[\/list\])?(.?)/s", $content, $matches)) {
return do_shortcode($content);
} else {
for($i = 0; $i < count($matches[0]); $i++) {
$matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
}
$out .= '<ul class="icons">';
for($i = 0; $i < count($matches[0]); $i++) {
$icon = ( $matches[3][$i]['icon'] ) ? '<i class="icon-'. $matches[3][$i]['icon'] .'"></i>' : '';
$out .= '<li>'. $icon . do_shortcode(trim($matches[5][$i])) .'</li>';
}
$out .= '</ul>';
}
return $out;
}