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:
<?php
$shortcodes_config['landing_pages'] = array(
'no_preview' => true,
'options' => array(
'heading' => array(
'name' => __('Heading Text', 'inbound-pro' ),
'desc' => __('Enter the heading text.', 'inbound-pro' ),
'type' => 'text',
'std' => 'Recent Landing Pages'
),
'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' => '4'
),
'number' => array(
'name' => __('Post Number', 'inbound-pro' ),
'desc' => __('Enter the number of post to show. (enter -1 for all posts)', 'inbound-pro' ),
'type' => 'text',
'std' => '4'
),
'cat' => array(
'name' => __('Category', 'inbound-pro' ),
'desc' => __('Optional you can sort by a category.', 'inbound-pro' ),
'type' => 'select',
'options' => $lp_cats,
'std' => ''
),
'excerpt_lenght' => array(
'name' => __('Excerpt Lenght', 'inbound-pro' ),
'desc' => __('The post excerpt word lenght.', 'inbound-pro' ),
'type' => 'text',
'std' => '30'
),
'thumbs' => array(
'name' => __('Show Featured Thumbnails', 'inbound-pro' ),
'checkbox_text' => __('Uncheck to hide featured thumbnails', 'inbound-pro' ),
'desc' => '',
'type' => 'checkbox',
'std' => '1'
),
),
'shortcode' => '[landing_pages heading="{{heading}}" column="{{column}}" number="{{number}}" cat="{{cat}}" excerpt_lenght="{{excerpt_lenght}}" thumbs="{{thumbs}}"]',
'popup_title' => __('Insert Landing Page List Shortcode', 'inbound-pro' )
);
$freshbuilder_modules['landing_pages'] = array(
'name' => __('Entries', 'inbound-pro' ),
'size' => 'one_full',
'options' => array(
'heading' => array(
'name' => __('Heading', 'inbound-pro' ),
'desc' => __('Enter the heading text.', 'inbound-pro' ),
'type' => 'text',
'std' => 'Recent Posts',
'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' => '4',
'class' => '',
'is_content' => '0'
),
'number' => array(
'name' => __('Post Number', 'inbound-pro' ),
'desc' => __('Enter the number of post to show.', 'inbound-pro' ),
'type' => 'text',
'std' => '4',
'class' => '',
'is_content' => '0'
),
'cat' => array(
'name' => __('Category', 'inbound-pro' ),
'desc' => __('Optional you can sort by a category.', 'inbound-pro' ),
'type' => 'select',
'options' => $lp_cats,
'std' => '',
'class' => '',
'is_content' => '0'
),
'excerpt_lenght' => array(
'name' => __('Excerpt Lenght', 'inbound-pro' ),
'desc' => __('The post excerpt word lenght.', 'inbound-pro' ),
'type' => 'text',
'std' => '30',
'class' => '',
'is_content' => '0'
)
)
);
add_shortcode('landing_pages', 'inbound_shortcode_landing_pages');
if (!function_exists('inbound_shortcode_landing_pages')) {
function inbound_shortcode_landing_pages( $atts, $content = null ) {
extract(shortcode_atts(array(
'heading' => 'Recent Posts',
'column' => '4',
'number' => '4',
'cat' => '',
'excerpt_lenght' => '30',
'thumbs' => '1'
), $atts));
$grid = ' inbound-grid full';
if ($column == '2') $grid = ' inbound-grid one-half';
if ($column == '3') $grid = ' inbound-grid one-third';
if ($column == '4') $grid = ' inbound-grid one-fourth';
if ($column == '5') $grid = ' inbound-grid one-fifth';
$out = '';
$i = 0;
$out .= '<div class="inbound-row">';
if ($heading != '') $out .= '<div class="inbound-grid full"><div class="heading"><h3>'.$heading.'</h3><div class="sep"></div></div></div>';
$number = ($number) ? $num = $number : $num = -1;
$cat = ($cat) ? "$cat" : '';
if ($cat === 'all' || $cat === '') {
$args = array(
'post_type' => 'landing-page',
'posts_per_page' => $number,
);
} else {
$args = array(
'post_type' => 'landing-page',
'posts_per_page' => $number,
'tax_query' => array(
array(
'taxonomy' => 'landing_page_category',
'field' => 'id',
'terms' => $cat
))
);
}
$loop = new WP_Query( $args);
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post(); $i++;
$id = $loop->post->ID;
$thumbnail = '';
$title = get_the_title($id);
if(empty($title)){
$title = get_post_meta( $id , 'lp-main-headline',true );
}
if ($thumbs != 0){
$thumbnail = get_the_post_thumbnail($post->ID, '500x360');
}
$out .= '<div class="'.$grid.'">';
$out .= '<div class="recent-entry inbound-clearfix">'.$thumbnail.'';
$out .= '<header class="recent-entry-header">';
$out .= '<h3 class="recent-entry-title"><a class="reserve" href="'.get_permalink().'" title="" rel="bookmark">'.$title.'</a></h3>';
$out .= '</header>';
$out .= '<div class="recent-entry-summary">';
$out .= '</div>';
$out .= '</div>';
$out .= '</div>';
if( $i == $column ) $out .= '<div class="inbound-clear"></div>';
endwhile;
endif;
wp_reset_postdata();
$out .= '</div>';
return $out;
}
}