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:
<?php
$shortcodes_config['testimonial'] = array(
'no_preview' => true,
'options' => array(
'heading' => array(
'name' => __('Heading Text', 'inbound-pro' ),
'desc' => __('Enter the heading text.', 'inbound-pro' ),
'type' => 'text',
'std' => 'Testimonial'
),
'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' => '1'
)
),
'child' => array(
'options' => array(
'author' => array(
'name' => __('Testimony Author', 'leads'),
'desc' => __('Enter the testimony author name.', 'leads'),
'type' => 'text',
'std' => ''
),
'meta' => array(
'name' => __('Testimony Author Meta', 'inbound-pro' ),
'desc' => __('The author job, company or website name.', 'inbound-pro' ),
'type' => 'text',
'std' => ''
),
'content' => array(
'name' => __('Testimony Content', 'leads'),
'desc' => __('Put the content here.', 'leads'),
'type' => 'textarea',
'std' => ''
)
),
'shortcode' => '[testimony author="{{author}}" meta="{{meta}}"]{{content}}[/testimony]',
'clone' => __('Add More Testimony', 'cta' )
),
'shortcode' => '[testimonial heading="{{heading}}" column="{{column}}"]{{child}}[/testimonial]',
'popup_title' => 'Insert Testimonial Shortcode'
);
$freshbuilder_modules['testimonial'] = array(
'name' => __('Testimonial', 'inbound-pro' ),
'size' => 'one_half',
'options' => array(
'heading' => array(
'name' => __('Heading', 'inbound-pro' ),
'desc' => __('Enter the heading text.', 'inbound-pro' ),
'type' => 'text',
'std' => 'Testimonial',
'class' => '',
'is_content' => 0
),
'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',
'class' => '',
'is_content' => 0
)
),
'child' => array(
'author' => array(
'name' => __('Testimony Author', 'inbound-pro' ),
'desc' => __('Enter the testimony author name.', 'inbound-pro' ),
'type' => 'text',
'std' => '',
'class' => '',
'is_content' => 0
),
'meta' => array(
'name' => __('Testimony Author Meta', 'inbound-pro' ),
'desc' => __('The author job, company or website name.', 'inbound-pro' ),
'type' => 'text',
'std' => '',
'class' => '',
'is_content' => 0
),
'content' => array(
'name' => __('Testimony Text', 'inbound-pro' ),
'desc' => __('Put the content here.', 'inbound-pro' ),
'type' => 'textarea',
'std' => '',
'class' => '',
'is_content' => 1
)
),
'child_code' => 'testimony'
);
add_shortcode('testimonial', 'inbound_shortcode_testimonial');
function inbound_shortcode_testimonial( $atts, $content = null ) {
extract(shortcode_atts(array(
'heading' => __('Testimonial', 'inbound-pro' ),
'column' => 1,
), $atts));
$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';
$out = '';
$out .= '<div class="testimonial row">';
if ($heading != '') {
$out .= '<div class="grid full"><div class="heading"><h3>'.$heading.'</h3><div class="sep"></div></div></div>';
}
if (!preg_match_all("/(.?)\[(testimony)\b(.*?)(?:(\/))?\](?:(.+?)\[\/testimony\])?(.?)/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]);
}
for($i = 0; $i < count($matches[0]); $i++) {
$out .= '<div class="'.$grid.'">';
$out .= '<div class="fancy-quote">';
$out .= '<div class="quote-text">';
$out .= '<div class="triangle"></div>';
$out .= '<p>'.do_shortcode(trim($matches[5][$i])).'</p>';
$out .= '</div>';
$out .= '<div class="quote-author">';
if( $matches[3][$i]['author'] ) {
$out .= '<span class="quote-author-name">'.$matches[3][$i]['author'].'</span>';
}
if( $matches[3][$i]['meta'] ){
$out .= ' - <span class="quote-author-meta">'.$matches[3][$i]['meta'].'</span>';
}
$out .= '</div>';
$out .= '</div>';
$out .= '</div>';
if( $i == $column - 1 ) {
$out .= '<div class="clear"></div>';
}
}
}
$out .= '</div>';
return $out;
}