Exemple #1
0
    function getLatestCategoryItems($cat_id, $post_type = 'post')
    {
        $args = array('posts_per_page' => 3, 'category' => $cat_id, 'post_type' => $post_type);
        $posts = get_posts($args);
        $html = '';
        ob_start();
        global $post;
        $tmp_post = $post;
        $options = get_option('mashmenu_options');
        $sizes = $options['thumbnail_size'];
        $width = 520;
        $height = 354;
        if ($sizes != '') {
            $sizes = explode('x', $sizes);
            if (count($sizes) == 2) {
                $width = intval($sizes[0]);
                $height = intval($sizes[1]);
                if ($width == 0) {
                    $width = 200;
                }
                if ($height == 0) {
                    $height = 200;
                }
            }
        }
        $content_helper = new CT_ContentHtml();
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
		<div class="content-item col-md-4">
			<?php 
            echo $content_helper->get_item_small_video('thumb_260x146', 1, 1, 1, 1, '0');
            ?>
		</div>
		<?php 
        }
        $html = ob_get_contents();
        ob_end_clean();
        $temp_post = '';
        $post = $temp_post;
        return $html;
    }