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: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255:
<?php
$shortcodes_config['teaser'] = array(
'no_preview' => true,
'options' => array(
'heading' => array(
'name' => __('Heading', 'inbound-pro' ),
'desc' => __('Enter the heading text', 'inbound-pro' ),
'type' => 'text',
'std' => ''
),
'style' => array(
'name' => __('Style', 'inbound-pro' ),
'desc' => __('Select the style.', 'inbound-pro' ),
'type' => 'select',
'options' => array(
'' => __('Default', 'inbound-pro' ),
'nested' => __('Nested', 'inbound-pro' ),
'centered' => __('Centered', 'inbound-pro' )
),
'std' => ''
),
'column' => array(
'name' => __('Column', 'inbound-pro' ),
'desc' => __('Select the number of column(s).', 'inbound-pro' ),
'type' => 'select',
'options' => array(
'1' => __('1 Column', 'inbound-pro' ),
'2' => __('2 Columns', 'inbound-pro' ),
'3' => __('3 Columns', 'inbound-pro' ),
'4' => __('4 Columns', 'inbound-pro' ),
'5' => __('5 Columns', 'inbound-pro' )
),
'std' => '3'
)
),
'child' => array(
'options' => array(
'title' => array(
'name' => __('Title', 'inbound-pro' ),
'desc' => __('Enter the title.', 'inbound-pro' ),
'type' => 'text',
'std' => ''
),
'subtitle' => array(
'name' => __('Sub Title', 'inbound-pro' ),
'desc' => __('Enter the sub title.', 'inbound-pro' ),
'type' => 'text',
'std' => ''
),
'icon' => array(
'name' => __('Icon', 'inbound-pro' ),
'desc' => __('Select an icon.', 'inbound-pro' ),
'type' => 'select',
'options' => $fontawesome,
'std' => ''
),
'image' => array(
'name' => __('Image URL', 'inbound-pro' ),
'desc' => __('Enter your image url, it will override the icon above', 'inbound-pro' ),
'type' => 'text',
'std' => '',
'class' => ''
),
'link' => array(
'name' => __('Link', 'inbound-pro' ),
'desc' => __('The title link destination URL.', 'inbound-pro' ),
'type' => 'text',
'std' => ''
),
'content' => array(
'name' => __('Teaser Content', 'inbound-pro' ),
'desc' => __('Enter the content.', 'inbound-pro' ),
'type' => 'textarea',
'std' => ''
)
),
'shortcode' => '[block title="{{title}}" subtitle="{{subtitle}}" icon="{{icon}}" link="{{link}}" ]{{content}}[/block]',
'clone' => __('Add More Block', 'cta' )
),
'shortcode' => '[teaser heading="{{heading}}" style="{{style}}" column="{{column}}"]{{child}}[/teaser]',
'popup_title' => 'Insert Teaser Shortcode'
);
$freshbuilder_modules['teaser'] = array(
'name' => __('Teaser', 'inbound-pro' ),
'size' => 'one_full',
'options' => array(
'heading' => array(
'name' => __('Heading', 'inbound-pro' ),
'desc' => __('Enter the heading text.', 'inbound-pro' ),
'type' => 'text',
'std' => '',
'class' => '',
'is_content' => 0
),
'style' => array(
'name' => __('Style', 'inbound-pro' ),
'desc' => __('Select the style.', 'inbound-pro' ),
'type' => 'select',
'options' => array(
'' => __('Default', 'inbound-pro' ),
'nested' => __('Nested', 'inbound-pro' ),
'centered' => __('Centered', 'inbound-pro' )
),
'std' => '',
'class' => '',
'is_content' => 0
),
'column' => array(
'name' => __('Column', 'inbound-pro' ),
'desc' => __('Select the column.', 'inbound-pro' ),
'type' => 'select',
'options' => array(
'1' => __('1 Column', 'inbound-pro' ),
'2' => __('2 Columns', 'inbound-pro' ),
'3' => __('3 Columns', 'inbound-pro' ),
'4' => __('4 Columns', 'inbound-pro' ),
'5' => __('5 Columns', 'inbound-pro' )
),
'std' => '3',
'class' => '',
'is_content' => 0
)
),
'child' => array(
'icon' => array(
'name' => __('Icon', 'inbound-pro' ),
'desc' => __('Select an icon.', 'inbound-pro' ),
'type' => 'select',
'options' => $fontawesome,
'std' => 'none',
'class' => '',
'is_content' => 0
),
'image' => array(
'name' => __('Image URL', 'inbound-pro' ),
'desc' => __('Enter your image url, it will override the icon above', 'inbound-pro' ),
'type' => 'text',
'std' => '',
'class' => '',
'is_content' => 0
),
'title' => array(
'name' => __('Title', 'inbound-pro' ),
'desc' => __('Enter the heading text.', 'inbound-pro' ),
'type' => 'text',
'class' => '',
'is_content' => 0
),
'subtitle' => array(
'name' => __('Sub Title', 'inbound-pro' ),
'desc' => __('Enter the sub title.', 'inbound-pro' ),
'type' => 'text',
'class' => '',
'is_content' => 0
),
'link' => array(
'name' => __('Link', 'inbound-pro' ),
'desc' => __('The title link destination URL.', 'inbound-pro' ),
'type' => 'text',
'class' => '',
'is_content' => 0
),
'content' => array(
'name' => __('Content', 'inbound-pro' ),
'desc' => __('Enter the content.', 'inbound-pro' ),
'type' => 'textarea',
'std' => '',
'class' => '',
'is_content' => 1
)
),
'child_code' => 'block'
);
add_shortcode('teaser', 'inbound_shortcode_teaser');
function inbound_shortcode_teaser( $atts, $content = null ) {
extract(shortcode_atts(array(
'heading' => '',
'style' => '',
'column' => '4'
), $atts));
$out = '';
$grid = ' grid full';
if ($column == '2') $grid = ' grid one-half';
if ($column == '3') $grid = ' grid one-third';
if ($column == '4') $grid = ' grid one-fourth';
if ($column == '5') $grid = ' grid one-fifth';
$style = ($style != '') ? ' '. $style : '';
if (!preg_match_all("/(.?)\[(block)\b(.*?)(?:(\/))?\](?:(.+?)\[\/block\])?(.?)/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 .= '<div class="row">';
if ($heading != '') {
$out .= '<div class="grid full"><div class="heading"><h3>'.$heading.'</h3><div class="sep"></div></div></div>';
}
for($i = 0; $i < count($matches[0]); $i++) {
$title = ( $matches[3][$i]['link'] ) ? '<a class="reserve" href="'. $matches[3][$i]['link'] .'">'. $matches[3][$i]['title'] .'</a>' : $matches[3][$i]['title'];
$out .= '<aside class="teaser'. $grid . $style .'">';
if( $matches[3][$i]['image'] ) {
$out .= '<div class="teaser-image"><img src="'. $matches[3][$i]['image'] .'" alt="" /></div>';
}
elseif ( $matches[3][$i]['icon'] ) {
$out .= '<div class="teaser-icon"><i class="icon-'. $matches[3][$i]['icon'] .'"></i></div>';
}
$out .= '<header class="teaser-header">';
$out .= '<h3 class="teaser-title">'.$title.'</h3>';
if( $matches[3][$i]['subtitle'] ) {
$out .= '<div class="teaser-subtitle">'. $matches[3][$i]['subtitle'] .'</div>';
}
$out .= '</header>';
if( $matches[5][$i] ) {
$out .= '<div class="teaser-content">'.do_shortcode( trim($matches[5][$i]) ).'</div>';
}
$out .= '</aside>';
}
if( $i == $column - 1 ) {
$out .= '<div class="clear"></div>';
}
$out .= '</div>';
}
return $out;
}