function parse_tm_related_post_func($atts, $content)
{
    $title = isset($atts['title']) ? $atts['title'] : '';
    $postformat = isset($atts['postformat']) ? $atts['postformat'] : '';
    $posttypes = isset($atts['posttypes']) ? $atts['posttypes'] : 'post';
    $count = isset($atts['count']) ? $atts['count'] : '';
    $tags = isset($atts['tag']) ? $atts['tag'] : '';
    $orderby = isset($atts['orderby']) ? $atts['orderby'] : '';
    if (function_exists('ot_get_option')) {
        $themes_pur = ot_get_option('theme_purpose');
    }
    if (function_exists('ot_get_option')) {
        $layout_ct_video = ot_get_option('single_layout_ct_video');
        if ($layout_ct_video != 'full') {
            $count = '4';
        } else {
            $count = '6';
        }
    }
    if (class_exists('CT_ContentHelper')) {
        $item_loop_video = new CT_ContentHelper();
        $the_query = $item_loop_video->tm_get_related_posts($posttypes, $tags, $postformat, $count, $orderby, $args = array());
        $thumb = 'thumb_196x126';
        $show_title = 1;
        $show_meta = $show_exceprt = 0;
        $item_video = new CT_ContentHtml();
        if ($the_query->have_posts()) {
            $html = '
			<div class="smart-box smart-box-style-2 is-carousel" >';
            $html .= '<div class="smart-box-head">
			<h2 class="light-title">' . $title . '</h2>
			</div>
			<div class="smart-box-content">
				<div class="smart-item">
					<div class="row">
			';
            while ($the_query->have_posts()) {
                $the_query->the_post();
                if ($layout_ct_video != 'full') {
                    $html .= '
					<div class="col-md-3 col-sm-6 col-xs-6">';
                } else {
                    $html .= '
					<div class="col-md-2 col-sm-6 col-xs-6">';
                }
                $html .= $item_video->get_item_medium_video($thumb, $show_title, $show_exceprt, $show_meta, $themes_pur);
                $html .= '</div>';
            }
            $html .= '</div>
				</div>
			</div>
		</div>
		<div class="clear"></div>
		';
        }
        wp_reset_query();
        return $html;
    }
}
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;
    }
}