File: /home/aprilnet/public_html/sciohost.org/wp-content/themes/doris/inc/blocks/posts_grid_e.php
<?php
if (!class_exists('doris_posts_grid_e')) {
class doris_posts_grid_e {
static $pageInfo=0;
public function render( $page_info ) {
$block_str = '';
$moduleID = uniqid('doris_posts_grid_e-');
$moduleConfigs = array();
$moduleData = array();
self::$pageInfo = $page_info;
//get config
$moduleConfigs['title'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_title', true );
$moduleConfigs['orderby'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_orderby', true );
$moduleConfigs['tags'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_tags', true );
$moduleConfigs['limit'] = 3;
$moduleConfigs['offset'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_offset', true );
$moduleConfigs['feature'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_feature', true );
$moduleConfigs['category_id'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_category', true );
$moduleConfigs['editor_pick'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_editor_pick', true );
$moduleConfigs['editor_exclude'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_editor_exclude', true );
$moduleConfigs['post_source'] = get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_post_source', true );
$moduleInfo = array(
'post_source' => $moduleConfigs['post_source'],
'post_icon' => get_post_meta( $page_info['page_id'], $page_info['block_prefix'].'_post_icon', true ),
'iconPosition' => 'top-right',
);
$the_query = bk_get_query::doris_query($moduleConfigs); //get query
if ( $the_query->have_posts()) :
$block_str .= '<div id="'.$moduleID.'" class="doris-block doris-post--grid-e">';
$block_str .= '<div class="post--grid-d__inner">';
$block_str .= atbs_core::bk_get_doris_module_heading('', $moduleConfigs['title']);
if ( $the_query->have_posts() ) :
$block_str .= $this->render_modules($the_query, $moduleInfo); //render modules
endif; //render modules
$block_str .= '</div><!-- .container -->';
$block_str .= '</div><!-- .doris-block -->';
endif;
unset($moduleConfigs); unset($the_query); //free
wp_reset_postdata();
return $block_str;
}
public function render_modules($the_query, $moduleInfo = ''){
$render_modules = '';
$postSource = $moduleInfo['post_source'];
$postIcon = $moduleInfo['post_icon'];
$iconPosition = 'top-right';
$bypassPostIconDetech = 0;
$postIconAttr = array();
$postIconAttr['postIconClass'] = '';
$postIconAttr['iconType'] = '';
if($postIcon == 'disable') {
$bypassPostIconDetech = 1;
}else {
$bypassPostIconDetech = 0;
}
if ( $the_query->have_posts() ) :
$postVerticalHTML = new doris_vertical_1;
$postVerticalAttr = array (
'additionalClass' => 'doris-post--vertical',
'cat' => 0,
'catClass' => '',
'thumbSize' => 'doris-xs-1_1',
'typescale' => 'typescale-4',
'readmore' => 1,
'postIcon' => $postIconAttr,
);
$postVerticalHTML_L = new doris_vertical_4;
$postVerticalAttr_L = array (
'cat' => 1,
'catClass' => '',
'thumbSize' => 'doris-xs-4_3',
'typescale' => 'typescale-2',
'meta' => array('date_without_icon'),
);
$render_module_L = '';
$render_modules .= '<div class="post--grid-e__wrap row">';
while ( $the_query->have_posts() ): $the_query->the_post();
if($the_query->current_post == 0) :
if($bypassPostIconDetech != 1) {
if($postSource != 'all') {
$postIconAttr['iconType'] = $postSource;
}else {
$postIconAttr['iconType'] = atbs_core::bk_post_format_detect(get_the_ID());
}
$postIconAttr['postIconClass'] = atbs_core::get_post_icon_class($postIconAttr['iconType'], '', $iconPosition);
$postVerticalAttr_L['postIcon'] = $postIconAttr;
}
$postVerticalAttr_L['postID'] = get_the_ID();
$render_modules .= '<div class="col-sm-5 small-post-vertical big-post-vertical-e">';
$render_modules .= $postVerticalHTML_L->render($postVerticalAttr_L);
$render_modules .= '</div>';
else:
if($the_query->current_post == 1) :
$render_modules .= '<div class="col-sm-7 small-post-vertical-e "><div class="row small-post-vertical-e__inner">';
endif;
$postVerticalAttr['postID'] = get_the_ID();
if($bypassPostIconDetech != 1) {
$addClass = 'overlay-item--sm-p';
if($postSource != 'all') {
$postIconAttr['iconType'] = $postSource;
}else {
$postIconAttr['iconType'] = atbs_core::bk_post_format_detect(get_the_ID());
}
$postIconAttr['postIconClass'] = atbs_core::get_post_icon_class($postIconAttr['iconType'], '', $iconPosition, $addClass);
$postVerticalAttr['postIcon'] = $postIconAttr;
}
$render_modules .= '<div class="col-sm-6 small-post-vertical-e-mobile doris-post--vertical-list">';
$render_modules .= $postVerticalHTML->render($postVerticalAttr);
$render_modules .= '</div>';
$currentPost = $the_query->current_post;
endif;
endwhile;
if($currentPost >= 1) :
$render_modules .= '</div></div>';
endif;
$render_modules .= $render_module_L;
$render_modules .= '</div>';
endif;
return $render_modules;
}
}
}