Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $coolist_options;
- $args_featured = array(
- 'meta_query' => array(
- array(
- 'key' => 'themewaves_coolist_options',
- 'compare' => 'LIKE',
- 'value' => 'featured',
- )
- )
- );
- $args_trending = array(
- 'meta_query' => array(
- array(
- 'key' => 'themewaves_coolist_options',
- 'compare' => 'LIKE',
- 'value' => 'trending',
- )
- )
- );
- $args_recent = array();
- $args_recent1 = array(
- 'meta_query' => array(
- 'relation' => 'OR',
- array(
- 'key' => 'themewaves_coolist_options',
- 'compare' => 'NOT EXISTS'
- ),
- array(
- 'key' => 'themewaves_coolist_options',
- 'compare' => 'NOT LIKE',
- 'value' => 'featured',
- )
- )
- );
- $args_recent2 = array(
- 'meta_query' => array(
- 'relation' => 'OR',
- array(
- 'key' => 'themewaves_coolist_options',
- 'compare' => 'NOT EXISTS'
- ),
- array(
- 'relation' => 'AND',
- array(
- 'key' => 'themewaves_coolist_options',
- 'compare' => 'NOT LIKE',
- 'value' => 'trending',
- ),
- array(
- 'key' => 'themewaves_coolist_options',
- 'compare' => 'NOT LIKE',
- 'value' => 'featured',
- )
- )
- )
- );
- $args = array();
- if(!empty($coolist_options['cat_name']) && $coolist_options['cat_name']!='all_cats'){
- $args['category_name'] = $coolist_options['cat_name'];
- }
- $row_class = '';
- $blog_rows0 = 1;
- if(is_page() && $coolist_options['cat_name'] != 'all_cats'){
- if(!empty($coolist_options['row_title']) && !empty($coolist_options['cat_name'])){
- $row_title = coolist_option('row_title', esc_html__('Coolist %s', 'coolist'));
- $viewall = coolist_option('row_viewall', esc_html__('View all', 'coolist'));
- $cat_obj = get_category_by_slug( $coolist_options['cat_name'] );
- echo '<div class="row-title"><h3>'.sprintf( esc_html($row_title), ('<span>'.esc_html($cat_obj->cat_name).'</span>') ).'</h3>';
- echo '<a href="'.esc_url( get_category_link( $cat_obj->cat_ID ) ).'">'.esc_html($viewall).'</a></div>';
- }
- } else {
- $paged = (get_query_var('paged')) ? intval(get_query_var('paged')) : 1;
- $args['paged'] = $paged;
- global $page;
- if (is_page() && is_front_page() && $page) {
- $args['paged'] = $page;
- }
- $row_class = ' blog-infinite';
- $title_recent = $title_recent1 = $title_recent2 = coolist_option('whats_new', esc_html__('What\'s New', 'coolist'));
- $title_featured = coolist_option('whats_hot', esc_html__('What\'s Hot', 'coolist'));
- $title_trending = coolist_option('whats_rising', esc_html__('What\'s Rising', 'coolist'));
- $blog_rows0 = coolist_option('posts_per_page', 6);
- $coolist_options['pagination'] = coolist_option('blog_pagination', 'infinite');
- }
- $crLt = !empty($coolist_options['blog_layout']) ? $coolist_options['blog_layout'] : 'style_1';
- if(!empty($coolist_options['category_layout'])){
- $crLt = $coolist_options['category_layout'];
- }
- $rowlayouts = coolist_blog_layout();
- $rowlayout = empty($coolist_options['sidebar']) ? $rowlayouts[$crLt]['layout'] : $rowlayouts[$crLt]['layout1'];
- $tab_title = '';
- $tab_active = ' active';
- echo '<div class="blog-row '.esc_attr($crLt.$row_class).'">';
- if(isset($rowlayout[0])){
- $i = 0;
- foreach ($rowlayout as $pposts){
- if(!empty($coolist_options['post__not_in'])){
- $args['post__not_in'] = $coolist_options['post__not_in'];
- }
- $blog_rows = $blog_rows0;
- if(is_array($pposts['position'])){
- $position = $pposts['position'][0];
- if($position != 'list') {
- $blog_rows = $blog_rows * count($pposts['position']);
- }
- $pposts['position'] = $position;
- }
- switch ($pposts['position']) {
- case 'list':
- $args['posts_per_page'] = ($blog_rows * 3);
- if(!empty($coolist_options['category_list']) && $coolist_options['category_list'] == 'style_2'){
- $args['posts_per_page'] = ($blog_rows * 4);
- $pposts['position'] = 'list2';
- }
- break;
- default:
- $args['posts_per_page'] = $blog_rows;
- break;
- }
- $meta_query = 'args_'.$pposts['query'];
- if(empty($row_title) && isset($title_recent)){
- $title = 'title_'.$pposts['query'];
- $tab_title .= '<h5 class="tab-title'.esc_attr($tab_active).'" data-href="blog-column-'.esc_attr($i).'">'.esc_html($$title).'</h5>';
- }
- if($pposts['position'] == 'large' && !empty($coolist_options['category_large']) && $coolist_options['category_large'] == 'style_2'){
- $pposts['position'] = 'large2';
- } elseif($pposts['position'] == 'grid' && !empty($coolist_options['category_grid']) && $coolist_options['category_grid'] == 'style_2'){
- $pposts['position'] = 'grid2';
- }
- $newargs = array_merge($args, $$meta_query);
- query_posts( $newargs );
- if(have_posts()){
- echo '<div class="blog-column'.esc_attr($tab_active).'" data-id="blog-column-'.esc_attr($i).'">';
- if(!empty($$title)){
- echo '<h5 class="column-title">'.esc_html($$title).'</h5>';
- }
- echo '<div class="column-posts">';
- while ( have_posts() ) { the_post();
- get_template_part('content', $pposts['position']);
- }
- if(!empty($coolist_options['pagination'])){
- coolist_pagination();
- }
- echo '</div>';
- echo '</div>';
- }
- wp_reset_query();
- $i++;
- $tab_active = '';
- }
- if($tab_title){
- echo '<div class="tw-blog-tab">'.($tab_title).'</div>';
- }
- }
- echo '</div>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement