function parse_smart_content_func($atts, $content) { $title = isset($atts['title']) ? $atts['title'] : ''; $ids = isset($atts['ids']) ? $atts['ids'] : ''; $column = isset($atts['column']) ? $atts['column'] : ''; $row = isset($atts['row']) ? $atts['row'] : '1'; $layout = isset($atts['layout']) ? $atts['layout'] : ''; $condition = isset($atts['condition']) ? $atts['condition'] : ''; $number = isset($atts['count']) ? $atts['count'] : '1'; $url_viewall = isset($atts['url_viewall']) ? $atts['url_viewall'] : ''; $categories = isset($atts['categories']) ? $atts['categories'] : ''; $sort_by = isset($atts['order']) ? $atts['order'] : 'DESC'; $tags = isset($atts['tags']) ? $atts['tags'] : ''; $label = isset($atts['label']) ? $atts['label'] : ''; $show_title = isset($atts['show_title']) ? $atts['show_title'] : ''; $show_exceprt = isset($atts['show_exceprt']) ? $atts['show_exceprt'] : ''; $show_rate = isset($atts['show_rate']) ? $atts['show_rate'] : ''; $show_dur = isset($atts['show_dur']) ? $atts['show_dur'] : ''; $show_view = isset($atts['show_view']) ? $atts['show_view'] : ''; $show_com = isset($atts['show_com']) ? $atts['show_com'] : ''; $show_like = isset($atts['show_like']) ? $atts['show_like'] : ''; $show_aut = isset($atts['show_aut']) ? $atts['show_aut'] : ''; $show_date = isset($atts['show_date']) ? $atts['show_date'] : ''; $number_excerpt = isset($atts['number_excerpt']) ? $atts['number_excerpt'] : 55; $quick_view = isset($atts['quick_view']) ? $atts['quick_view'] : 'def'; if ($number_excerpt == '') { $number_excerpt = apply_filters('excerpt_length', $number_excerpt, 1); } $num_r = ''; if (function_exists('ot_get_option')) { $themes_pur = ot_get_option('theme_purpose'); } if ($row == '') { $row = 1; } if ($layout == 'grid') { if ($column == 2) { $count = $number * 1; } else { if ($column == 4) { $count = $number * 5; } else { if ($column == 6) { $count = $number * 9; } } } } else { if ($layout == 'small_carousel') { $num_r = $row * $column; if ($column == 2) { $count = $number * 2 * $row; } else { if ($column == 4) { $count = $number * 4 * $row; } else { if ($column == 6) { $count = $number * 6 * $row; } } } } else { if ($layout == 'medium_carousel' || $layout == 'medium_carousel_2') { if ($column == 2) { $count = $number * 1 * $row; $num_r = $row * 1; } else { if ($column == 4) { $count = $number * 2 * $row; $num_r = $row * 2; } else { if ($column == 6) { $count = $number * 3 * $row; $num_r = $row * 3; } } } } else { if ($layout == 'single') { $count = $number * $row; } } } } //if(){ $count=$number;} if (class_exists('Mobile_Detect')) { $detect = new Mobile_Detect(); $_device_ = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'mobile' : 'pc'; $animation_class = isset($atts['animation']) && $_device_ == 'pc' ? 'wpb_' . $atts['animation'] . ' wpb_animate_when_almost_visible' : ''; } else { $animation_class = isset($atts['animation']) ? 'wpb_' . $atts['animation'] . ' wpb_animate_when_almost_visible' : ''; } if (class_exists('CT_ContentHelper')) { $item_video1 = new CT_ContentHelper(); $the_query = $item_video1->tm_get_popular_posts($condition, $tags, $count, $ids, $sort_by, $categories, $args = array(), $themes_pur); $num_item = count($the_query->posts); $html = ' <div class="smart-box '; $id = rand(); if ($layout == 'grid') { $html .= 'smart-box-style-1 is-carousel" id="' . $id . '"'; } else { if ($layout == 'small_carousel') { $html .= 'smart-box-style-2 is-carousel" id="' . $id . '"'; } else { if ($layout == 'medium_carousel') { $html .= 'smart-box-style-3 is-carousel" id="' . $id . '"'; } else { if ($layout == 'medium_carousel_2') { $html .= 'smart-box-style-3 smart-box-style-3-2 is-carousel" id="' . $id . '" data-pagi="pagi-' . $id . '"'; } else { if ($layout == 'single') { $html .= 'smart-box-style-4 is-carousel" id="' . $id . '"'; } } } } } $html .= '>'; $border_h = ''; $class_cssit = ''; if ($layout != 'grid') { $class_cssit = 'it-row'; } if ($the_query->have_posts()) { if ($title == '' && $url_viewall == '' && $number == '1') { $border_h = 'style="border:0"'; } if ($layout != 'medium_carousel_2') { $html .= '<div class="smart-box-head" ' . $border_h . '>'; if ($number == 1) { $html .= '<h2 class="light-title title">' . $title . '</h2>'; } else { if ($url_viewall != '') { $html .= '<h2 class="light-title title"><a class="title-link" href="' . $url_viewall . '">' . $title . '</a></h2>'; } else { $html .= '<h2 class="light-title title">' . $title . '</h2>'; } } $html .= '<div class="smart-control pull-right"> <a class="prev maincolor2 bordercolor2 bgcolor2hover" href="#" style="display: inline-block;"><i class="fa fa-angle-left"></i></a> <a class="next maincolor2 bordercolor2 bgcolor2hover" href="#" style="display: inline-block;"><i class="fa fa-angle-right"></i></a>'; if ($url_viewall != '' && $number == 1 && $label == '') { $html .= ' <a href="' . $url_viewall . '" class="bordercolor2 bgcolor2hover">' . __('View all', 'cactusthemes') . '</a>'; } else { if ($url_viewall != '' && $number == 1 && $label != '') { $html .= ' <a href="' . $url_viewall . '" class="bordercolor2 bgcolor2hover">' . $label . '</a>'; } } $html .= '</div> </div>'; } $html .= '<div class="smart-box-content">'; if ($layout != 'medium_carousel_2') { $html .= '<div class="smart-item ' . $class_cssit . '"> <div class="row">'; } $item_video = new CT_ContentHtml(); $item = 0; while ($the_query->have_posts()) { $the_query->the_post(); $item++; $html .= $item_video->get_all_item_video($item, $num_item, $column, $layout, $show_title, $show_exceprt, $show_rate, $show_dur, $show_view, $show_com, $show_like, $show_aut, $show_date, $themes_pur, $num_r, $number, $row, $class_cssit, $number_excerpt, $quick_view); } $html .= '</div>'; if ($layout == 'medium_carousel_2') { $html .= '<div class="carousel-dotted" id="pagi-' . $id . '"></div> '; } $html .= '</div>'; $html .= '<div class="clear"></div>'; } wp_reset_query(); return $html; } }