function widget($args, $instance)
    {
        wp_enqueue_script('jquery-isotope');
        $cache = wp_cache_get('widget_popular_videos', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($argsxx['widget_id'])) {
            $argsxx['widget_id'] = $this->id;
        }
        if (isset($cache[$argsxx['widget_id']])) {
            echo $cache[$argsxx['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $conditions = empty($instance['conditions']) ? '' : $instance['conditions'];
        $show_likes = empty($instance['show_likes']) ? '' : $instance['show_likes'];
        $show_com = empty($instance['show_com']) ? '' : $instance['show_com'];
        $show_view = empty($instance['show_view']) ? '' : $instance['show_view'];
        $show_rate = empty($instance['show_rate']) ? '' : $instance['show_rate'];
        $show_excerpt = empty($instance['show_excerpt']) ? '' : $instance['show_excerpt'];
        $num_ex = empty($instance['num_ex']) ? '' : $instance['num_ex'];
        $ids = empty($instance['ids']) ? '' : $instance['ids'];
        $title = empty($instance['title']) ? '' : $instance['title'];
        $title = apply_filters('widget_title', $title);
        $link = empty($instance['link']) ? '' : $instance['link'];
        $sort_by = empty($instance['sort_by']) ? '' : $instance['sort_by'];
        $number = empty($instance['number']) ? '' : $instance['number'];
        $thumb = empty($instance['thumb']) ? '' : $instance['thumb'];
        $thumb_w = empty($instance['thumb_w']) ? '' : $instance['thumb_w'];
        $thumb_h = empty($instance['thumb_h']) ? '' : $instance['thumb_h'];
        $cates = empty($instance['cats']) ? '' : $instance['cats'];
        if ($link != '') {
            $before_title .= '<a href=' . $link . '>';
            $after_title = '</a>' . $after_title;
        }
        if (function_exists('ot_get_option')) {
            $themes_pur = ot_get_option('theme_purpose');
        }
        if ($conditions == 'most_liked' && $ids == '' && class_exists('CT_ContentHelper')) {
            global $wpdb;
            $show_count = 1;
            $time_range = 'all';
            //$show_type = $instance['show_type'];
            $order_by = 'ORDER BY like_count DESC, post_title';
            if ($number > 0) {
                $limit = "LIMIT " . $number;
            }
            $widget_data = $before_widget;
            $widget_data .= $before_title . $title . $after_title;
            $show_excluded_posts = get_option('wti_like_post_show_on_widget');
            $excluded_post_ids = explode(',', get_option('wti_like_post_excluded_posts'));
            if (!$show_excluded_posts && count($excluded_post_ids) > 0) {
                $where = "AND post_id NOT IN (" . get_option('wti_like_post_excluded_posts') . ")";
            }
            //getting the most liked posts
            $query = "SELECT post_id, SUM(value) AS like_count, post_title FROM `{$wpdb->prefix}wti_like_post` L, {$wpdb->prefix}posts P ";
            $query .= "WHERE L.post_id = P.ID AND post_status = 'publish' AND value > -1 {$where} GROUP BY post_id {$order_by} {$limit}";
            $posts = $wpdb->get_results($query);
            $item_loop_video = new CT_ContentHtml();
            $cates_ar = $cates;
            if (count($posts) > 0) {
                $widget_data .= '
			<div class="widget-content">
					<div class="list-rating-item row">';
                foreach ($posts as $post) {
                    $cat_cur = get_the_category($post->post_id);
                    $cat_s = $cat_cur[0]->cat_ID;
                    $p_data = $excerpt = '';
                    $post_title = stripslashes($post->post_title);
                    $permalink = get_permalink($post->post_id);
                    $like_count = $post->like_count;
                    $p_data = get_post($post->post_id);
                    $excerpt = strip_tags($p_data->post_content);
                    $excerpt = wp_trim_words($excerpt, $num_ex, $more = '');
                    if ($cates != '') {
                        foreach ($cates_ar as $categs) {
                            if ($categs == $cat_s) {
                                $widget_data .= $item_loop_video->tm_likes_html($post, $like_count, $themes_pur, $show_likes, $show_com, $show_rate, $show_view, $show_excerpt, $excerpt);
                            }
                        }
                    } else {
                        $widget_data .= $item_loop_video->tm_likes_html($post, $like_count, $themes_pur, $show_likes, $show_com, $show_rate, $show_view, $show_excerpt, $excerpt);
                    }
                }
                //$widget_data .= $show_count == '1' ? ' ('.$like_count.')' : '';
                $widget_data .= '</div>
			</div>';
            }
            $widget_data .= $after_widget;
            echo $widget_data;
            wp_reset_postdata();
            $cache[$argsxx['widget_id']] = ob_get_flush();
            wp_cache_set('widget_trending_videos', $cache, 'widget');
        } else {
            if (class_exists('CT_ContentHelper')) {
                $item_loop_video = new CT_ContentHelper();
                $tag = $categories = '';
                if ($ids == '') {
                    $categories = $cates;
                }
                $the_query = $item_loop_video->tm_get_popular_posts($conditions, $tag, $number, $ids, $sort_by, $categories, $args = array(), $themes_pur);
                //			if(count($cats) > 0){
                //				$args = array('category__in' => $cats, 'showposts' => $number);
                //			}
                $html = $before_widget;
                if ($title) {
                    $html .= $before_title . $title . $after_title;
                }
                if ($the_query->have_posts()) {
                    $html .= '
					<div class="widget-content">
					<div class="list-rating-item row">
				';
                    $i = 0;
                    $item_video = new CT_ContentHtml();
                    while ($the_query->have_posts()) {
                        $the_query->the_post();
                        $i++;
                        $excerpt = get_the_excerpt();
                        $excerpt = wp_trim_words($excerpt, $num_ex, $more = '');
                        $html .= $item_video->get_item_video_trending($conditions, $themes_pur, $show_likes, $show_com, $show_rate, $show_view, $show_excerpt, $excerpt);
                    }
                    $html .= '</div>
				</div>';
                }
                $html .= $after_widget;
                echo $html;
                wp_reset_postdata();
                $cache[$argsxx['widget_id']] = ob_get_flush();
                wp_cache_set('widget_popular_videos', $cache, 'widget');
            }
        }
    }
Exemplo n.º 2
0
<?php

if (function_exists('wpfp_link')) {
    //check if active wp favorites post
    $header_bg = ot_get_option('header_home_bg');
    $current_bb_user = get_userdata(bp_displayed_user_id());
    $favorite_post_ids = wpfp_get_users_favorites($current_bb_user->user_login);
    if ($favorite_post_ids) {
        $favorite_post_ids = array_reverse($favorite_post_ids);
        $content_helper = new CT_ContentHelper();
        global $header_query;
        $playlist_number = ot_get_option('playlist_number', 10);
        $header_query = $content_helper->tm_get_popular_posts('playlist', '', $playlist_number, implode(",", $favorite_post_ids), '', '', $args = array(), '');
        ?>
<style type="text/css">
#classy-carousel{
<?php 
        if ($header_bg['background-color']) {
            echo 'background-color:' . $header_bg['background-color'] . ';';
        }
        if ($header_bg['background-attachment']) {
            echo 'background-attachment:' . $header_bg['background-attachment'] . ';';
        }
        if ($header_bg['background-repeat']) {
            echo 'background-repeat:' . $header_bg['background-repeat'] . ';';
            echo 'background-size: initial;';
        }
        if ($header_bg['background-position']) {
            echo 'background-position:' . $header_bg['background-position'] . ';';
        }
        if ($header_bg['background-image']) {
Exemplo n.º 3
0
function parse_tm_cat_videos_func($atts, $content)
{
    $condition = isset($atts['condition']) ? $atts['condition'] : '';
    $count = isset($atts['count']) ? $atts['count'] : -1;
    $categories = isset($atts['categories']) ? $atts['categories'] : '';
    if ($condition == 'likes' && class_exists('CT_ContentHelper')) {
        $atts = array();
        global $wpdb;
        $show_count = 1;
        $time_range = 'all';
        //$show_type = $instance['show_type'];
        $order_by = 'ORDER BY like_count DESC, post_title';
        if ($count > 0) {
            $limit = "LIMIT " . $count;
        }
        $show_excluded_posts = get_option('wti_like_post_show_on_widget');
        $excluded_post_ids = explode(',', get_option('wti_like_post_excluded_posts'));
        if (!$show_excluded_posts && count($excluded_post_ids) > 0) {
            $where = "AND post_id NOT IN (" . get_option('wti_like_post_excluded_posts') . ")";
        }
        //getting the most liked posts
        $query = "SELECT post_id, SUM(value) AS like_count, post_title FROM `{$wpdb->prefix}wti_like_post` L, {$wpdb->prefix}posts P ";
        $query .= "WHERE L.post_id = P.ID AND post_status = 'publish' AND value > 0 {$where} GROUP BY post_id {$order_by} {$limit}";
        $posts = $wpdb->get_results($query);
        $item_loop_video = new CT_ContentHtml();
        $widget_data = '
				<div id="top-carousel" class="cat-carousel">
					 <div class="container">
						<div class="is-carousel" id="top1">
							<div class="carousel-content">';
        if (count($posts) > 0) {
            foreach ($posts as $post) {
                $post_title = stripslashes($post->post_title);
                $permalink = get_permalink($post->post_id);
                $like_count = $post->like_count;
                $widget_data .= $item_loop_video->tm_likes_cat_html($post, $like_count);
            }
        }
        $widget_data .= '
						</div><!--/carousel-content-->
						<div class="carousel-button">
							<a href="#" class="prev maincolor1 bordercolor1 bgcolor1hover"><i class="fa fa-chevron-left"></i></a>
							<a href="#" class="next maincolor1 bordercolor1 bgcolor1hover"><i class="fa fa-chevron-right"></i></a>
						</div><!--/carousel-button-->
					</div><!--/is-carousel-->
					</div>
			</div>';
        wp_reset_query();
        return $widget_data;
    } else {
        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());
            $num_item = count($the_query->posts);
            $html = '
			<div id="top-carousel" class="cat-carousel">
				 <div class="container">
					<div class="is-carousel" id="top1">
						<div class="carousel-content">';
            if ($the_query->have_posts()) {
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    $html .= '   
							<div class="video-item">
								<div class="item-thumbnail">
									<a href="' . get_permalink() . '" title="' . get_the_title() . '">';
                    if (has_post_thumbnail()) {
                        $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumb_196x126', true);
                    } else {
                        $thumbnail[0] = function_exists('tm_get_default_image') ? tm_get_default_image() : '';
                    }
                    $html .= '
									<img src="' . $thumbnail[0] . '" alt="' . the_title_attribute('echo=0') . '" title="' . the_title_attribute('echo=0') . '">
										<div class="link-overlay fa fa-play"></div>
									</a>
									' . tm_post_rating(get_the_ID()) . '
									<div class="item-head">
										<h3><a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a></h3>
									</div>
								</div>
							</div>';
                }
            }
            $html .= '
						</div><!--/carousel-content-->
						<div class="carousel-button">
							<a href="#" class="prev maincolor1 bordercolor1 bgcolor1hover"><i class="fa fa-chevron-left"></i></a>
							<a href="#" class="next maincolor1 bordercolor1 bgcolor1hover"><i class="fa fa-chevron-right"></i></a>
						</div><!--/carousel-button-->
					</div><!--/is-carousel-->
					</div>
			</div>';
            wp_reset_query();
            return $html;
        }
    }
}
Exemplo n.º 4
0
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;
    }
}
Exemplo n.º 5
0
function parse_featured_content_func($atts, $content)
{
    $title = isset($atts['title']) ? $atts['title'] : '';
    $condition = isset($atts['condition']) ? $atts['condition'] : '';
    $count = isset($atts['count']) ? $atts['count'] : '6';
    $categories = isset($atts['categories']) ? $atts['categories'] : '';
    $sort_by = isset($atts['order']) ? $atts['order'] : 'DESC';
    $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;
    if ($number_excerpt == '') {
        $number_excerpt = apply_filters('excerpt_length', $number_excerpt, 1);
    }
    if (function_exists('ot_get_option')) {
        $themes_pur = ot_get_option('theme_purpose');
    }
    if (class_exists('CT_ContentHelper')) {
        ob_start();
        $contenthelper = new CT_ContentHelper();
        //$num_item = count($featured_query->posts);
        $contenthtml = new CT_ContentHtml();
        $categories_array = explode(',', $categories);
        ?>
        <div class="featured-content-box">
        	<div class="featured-content-box-inner">
            	<div class="featured-box-heading bgcolor2">
                	<h3 class="featured-box-title pull-left"><?php 
        echo $title;
        ?>
</h3>
                	<div class="featured-tabs pull-right hidden-xs">
                    	<ul class="list-inline">
                        <?php 
        $tab_count = 1;
        if ($categories) {
            foreach ($categories_array as $category) {
                // get category name
                $category_name = '';
                if (is_numeric($category)) {
                    $category_name = get_cat_name($category);
                } else {
                    $cat = get_category_by_slug($category);
                    if ($cat) {
                        $category_name = $cat->name;
                    }
                }
                echo '<li class="' . ($tab_count == 1 ? 'active' : '') . '"><a class="featured-tab" href="#' . $category . '" data-toggle="tab">' . $category_name . '</a></li>';
                $tab_count++;
            }
            $categories_array[] = '__allcat_hidden';
        } else {
            $categories_array = array('__allcat');
        }
        ?>
                        </ul>
                    </div>
                    <div class="clearfix"></div>
                </div><!--/featured-box-heading-->
                <div class="tab-content featured-box-content">
                <?php 
        foreach ($categories_array as $category) {
            $category_to_query = $category == '__allcat' ? '' : ($category == '__allcat_hidden' ? $categories : $category);
            $featured_query = $contenthelper->tm_get_popular_posts($condition, $tags, $count, $ids, $sort_by, $category_to_query, $args = array(), $themes_pur);
            $html_carousel = '';
            ?>
                	<div class="tab-pane fade featured-box-tab <?php 
            echo $category == $categories_array[0] ? 'in active' : '';
            echo $category == '__allcat_hidden' ? ' visible-xs in active' : ($category == '__allcat' ? '' : ' hidden-xs');
            ?>
" id="<?php 
            echo $category;
            ?>
">
                  		<div class="featured-box-tab-inner">
                            <div class="row">
                            	<div class="featured-control-col col-md-4 col-sm-4">
                                	<ul class="featured-control" data-id="<?php 
            echo $category;
            ?>
" >
                                        <?php 
            $featured_count = 0;
            while ($featured_query->have_posts()) {
                $featured_query->the_post();
                echo '<li><a class="item-cat-' . $category . ' item-cat-' . $category . '-' . $featured_count . ' ' . ($featured_count == 0 ? 'selected' : '') . '" data-pos=' . $featured_count . ' href="#">' . get_the_title() . '</a></li>';
                $html_carousel .= $contenthtml->get_item_medium_video($thumb = 'thumb_520x293', $show_title, $show_exceprt, $show_rate, $show_dur, $show_view, $show_com, $show_like, $show_aut, $show_date, $themes_pur, $number_excerpt);
                $featured_count++;
            }
            wp_reset_postdata();
            ?>
                                    </ul>
                                </div>
                                <div class="featured-carousel-col col-md-8 col-sm-8">
                                	<div class="featured-box-carousel is-carousel" data-pagi="pagi-<?php 
            echo $category;
            ?>
">
                                    	<div data-id="<?php 
            echo $category;
            ?>
" class="featured-box-carousel-content">
                                    	<?php 
            echo $html_carousel;
            ?>
                                        </div>
                                        <div id="pagi-<?php 
            echo $category;
            ?>
" class="carousel-pagination"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                	</div><!--featured-box-tab-->
                    <?php 
        }
        ?>
                </div>
            </div>
        </div><!--/featured-content-box-->
        <?php 
        $output_string = ob_get_contents();
        ob_end_clean();
        return $output_string;
    }
}
Exemplo n.º 6
0
function parse_tm_amazing_func($atts, $content)
{
    $condition = ot_get_option('header_home_condition', 'lastest');
    $ids = ot_get_option('header_home_postids', '');
    $categories = ot_get_option('header_home_cat', '');
    $tags = ot_get_option('header_home_tag', '');
    $sort_by = ot_get_option('header_home_order', 'DESC');
    $count = ot_get_option('header_home_number', 12);
    $themes_pur = '';
    if (function_exists('ot_get_option')) {
        $themes_pur = ot_get_option('theme_purpose');
    }
    if (class_exists('CT_ContentHelper')) {
        $conditions = 'latest';
        $ids = '';
        $item_loop_video = new CT_ContentHelper();
        $the_query = $item_loop_video->tm_get_popular_posts($condition, $tags, $count, $ids, $sort_by, $categories, $args = array(), $themes_pur);
        $num_item = count($the_query->posts);
        $show_title = 1;
        $show_meta = $show_exceprt = 0;
        $item_video = new CT_ContentHtml();
        if ($the_query->have_posts()) {
            $html = '
			<div id="slider" class="amazing" ' . (!ot_get_option('header_home_auto') ? 'data-notauto=1' : '') . (ot_get_option('header_home_auto_timeout') ? ' data-auto_timeout=' . ot_get_option('header_home_auto_timeout') : '') . (ot_get_option('header_home_auto_duration') ? ' data-auto_duration=' . ot_get_option('header_home_auto_duration') : '') . '>
			<div class="overlay">
				<div class="container">
					<div class="inner-slides"> ';
            $arr_thumb = array();
            $arr_id = array();
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $thumb = get_post_meta(get_the_ID(), 'ct_bg_image', true);
                if ($thumb == '') {
                    $thumb = get_post_thumbnail_id(get_the_ID());
                    $arr_thumb[] = $thumb;
                } else {
                    $arr_thumb[] = $thumb;
                }
                $html .= '
							<div class="slide">	
								<div class="container ">
								<div class="row video-item">
									<div class="col-md-6">
										<div class="item-thumbnail element ">
											<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail(get_the_ID(), 'thumb_100x100', array('alt' => get_the_title())) . '
											<div class="link-overlay fa fa-play "></div>
											</a>
										</div>
									</div>
									<div class="col-md-6">
										<div class="item-head element">
											<h3 class="item-heading"><a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '';
                if (tm_post_rating(get_the_ID())) {
                    $html .= tm_post_rating(get_the_ID()) . '<span class="rating-bar rate-ama bgcolor2">/10</span></a></h3>';
                } else {
                    $html .= '</a></h3>';
                }
                $html .= '<div class="item-info">
												<span class="item-date">' . get_the_time(get_option('date_format'), get_the_ID()) . '</span>
												<span class="item-author">by <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" title="' . get_the_author() . '" rel="author">' . get_the_author() . '</a></span>
											</div>
											<div class="item-content"><p>' . wp_trim_words(get_the_excerpt(), 15, $more = '') . '</p>
		</div>
																				<a class="ct-btn small " href="' . get_permalink() . '">' . __('View Details', 'cactusthemes') . '</a>
											<div class="clearfix"></div>
										</div>
									</div>
								</div>
								</div>
							</div>							
						';
            }
            $html .= '</div>
				</div>
			</div>
			<div class="bg-slides">';
            for ($i = 0; $i < $num_item; $i++) {
                $background_image_post = wp_get_attachment_image_src($arr_thumb[$i], 'full');
                $html .= '<div class="bg_slider" ><img src="' . $background_image_post[0] . '" /></div>';
            }
            //while($the_query->have_posts()){ $the_query->the_post();
            //$html .= get_the_post_thumbnail(get_the_ID(), 'thumb_100x100', array('alt' => get_the_title()));
            //}
            $html .= '	
			</div>
			<div class="carousel-button">
				<a href="#" class="prev maincolor1 bordercolor1 bgcolor1hover" style="display: block;"><i class="fa fa-chevron-left"></i></a>
				<a href="#" class="next maincolor1 bordercolor1 bgcolor1hover" style="display: block;"><i class="fa fa-chevron-right"></i></a>
			</div>
			<div class="carousel-pagination">
				<a href="#">1</a><a href="#">2</a><a href="#">3</a>
			</div>
        </div><!--/slider-->

		<div class="clear"></div>
		';
        }
        wp_reset_query();
        return $html;
    }
}
Exemplo n.º 7
0
function parse_tm_video_silder_func($atts, $content)
{
    $title = isset($atts['title']) ? $atts['title'] : '';
    $ids = isset($atts['ids']) ? $atts['ids'] : '';
    $condition = isset($atts['condition']) ? $atts['condition'] : '';
    $count = isset($atts['count']) ? $atts['count'] : '-1';
    $categories = isset($atts['categories']) ? $atts['categories'] : '';
    $sort_by = isset($atts['order']) ? $atts['order'] : 'DESC';
    $tags = isset($atts['tags']) ? $atts['tags'] : '';
    $themes_pur = '';
    if (function_exists('ot_get_option')) {
        $themes_pur = ot_get_option('theme_purpose');
    }
    if (class_exists('CT_ContentHelper')) {
        wp_enqueue_script('jquery-isotope');
        if ($condition == '') {
            $condition = 'latest';
        }
        $item_loop_video = new CT_ContentHelper();
        $the_query = $item_loop_video->tm_get_popular_posts($condition, $tags, $count, $ids, $sort_by, $categories, $args = array(), $themes_pur);
        $num_item = count($the_query->posts);
        $item_video = new CT_ContentHtml();
        if ($the_query->have_posts()) {
            $id = rand();
            $data_auto = 'data-notauto=1';
            if ($auto_play == 0) {
                $data_auto = 'data-notauto=1';
            }
            if (function_exists('ot_get_option')) {
                $page_layout = ot_get_option('page_layout');
                $sidebar_width = ot_get_option('sidebar_width');
            }
            $css_fl = '';
            if ($page_layout == 'right') {
                $css_fl = 'float: right;';
            }
            if ($sidebar_width == 1) {
                $sidebar_width = 'col-md-3';
            } else {
                $sidebar_width = 'col-md-4';
            }
            $html = '
			<div class="container video_slider">';
            $html .= '<div class="' . $sidebar_width . ' video-with" style=" padding-bottom:30px; ' . $css_fl . '">';
            $html .= '
			<div class="is-carousel simple-carousel testimonial tm-video-slider" ' . $data_auto . ' id="post-gallery' . $id . '">
				<div class="simple-carousel-content carousel-content">';
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $html .= '
							<div class="item-testi">
								<div class="tt-content icon-quote-right">
								<a href="' . get_permalink() . '" title="' . get_the_title() . '">
								' . get_the_post_thumbnail(get_the_ID(), 'thumb_365x235', array('alt' => get_the_title())) . '
								<div class="link-overlay fa fa-play "></div>
								</a>
								</div>
								<div class="name title"><h2>' . get_the_title() . '</h2></div>
								<div class="name pos">' . date_i18n(get_option('date_format'), strtotime(get_the_date())) . '</div>
								<div class="excerpt">' . wp_trim_words(get_the_excerpt(), 15, $more = '') . '</div>
								<a class="ct-btn small " href="' . get_permalink() . '">' . __('View Details', 'cactusthemes') . '</a>
								<p class="end"> &nbsp;</p>
							</div>';
            }
            $html .= '
			</div>
			<div class="carousel-pagination"></div>
		</div>';
            $html .= '</div>';
            $html .= '
		</div>
		<div class="clear"></div>
		';
        }
        wp_reset_query();
        return $html;
    }
}
Exemplo n.º 8
0
    $header_style = get_post_meta(get_the_ID(), 'header_style', true) ? get_post_meta(get_the_ID(), 'header_style', true) : $header_style;
}
$condition = get_post_meta(get_the_ID(), 'header_home_condition', true) ? get_post_meta(get_the_ID(), 'header_home_condition', true) : ot_get_option('header_home_condition', 'lastest');
$ids = get_post_meta(get_the_ID(), 'header_home_postids', true) ? get_post_meta(get_the_ID(), 'header_home_postids', true) : ot_get_option('header_home_postids', '');
$categories = get_post_meta(get_the_ID(), 'header_home_cat', true) ? get_post_meta(get_the_ID(), 'header_home_cat', true) : ot_get_option('header_home_cat', '');
$tags = get_post_meta(get_the_ID(), 'header_home_tag', true) ? get_post_meta(get_the_ID(), 'header_home_tag', true) : ot_get_option('header_home_tag', '');
$sort_by = get_post_meta(get_the_ID(), 'header_home_order', true) ? get_post_meta(get_the_ID(), 'header_home_order', true) : ot_get_option('header_home_order', 'DESC');
$count = get_post_meta(get_the_ID(), 'header_home_number', true) ? get_post_meta(get_the_ID(), 'header_home_number', true) : ot_get_option('header_home_number', 12);
$themes_pur = '';
if (function_exists('ot_get_option')) {
    $themes_pur = ot_get_option('theme_purpose');
}
if ($header_style != 'sidebar') {
    $content_helper = new CT_ContentHelper();
    global $header_query;
    $header_query = $content_helper->tm_get_popular_posts($condition, $tags, $count, $ids, $sort_by, $categories, $args = array(), $themes_pur);
}
if ($header_style == 'carousel') {
    get_template_part('header', 'home-carousel');
} elseif ($header_style == 'classy') {
    get_template_part('header', 'home-classy');
} elseif ($header_style == 'classy2' || $header_style == 'classy3') {
    get_template_part('header', 'home-classy-horizon');
} elseif ($header_style == 'metro') {
    get_template_part('header', 'home-metro');
} elseif ($header_style == 'amazing') {
    get_template_part('header', 'home-amazing');
} elseif ($header_style == 'video_slider') {
    get_template_part('header', 'home-videoslider');
} else {
    if (is_active_sidebar('maintop_sidebar')) {