<?php
$my_post_video_options=get_post_meta(get_the_ID(),'my_post_video_options',1);
$post_has_video = ! empty($my_post_video_options['video_url']) ? true : false;
?>
<div class="card-item b-r-4 ceo-background-default ceo-overflow-hidden ceo-vip-icons">
    <?php if(_ceo('ceo_cat_viptb') == true ): ?>
        <?php if(get_post_meta(get_the_ID(),'member_down',1)!=1){?>
        <span class="meta-vip-tag"></span>
        <?php }?>
    <?php endif; ?>

    <?php
        $img_w=_ceo('thumbnail-px')['width'];
        $img_h=_ceo('thumbnail-px')['height'];
        $style_w_h='';
    if(!empty($category = get_queried_object())){
        $category_id=$category->term_id;
        $thumbnail_custom = get_term_meta($category_id, 'thumbnail_px_custom', 'true');
        if(!empty($thumbnail_custom) && !empty($thumbnail_custom['height'])){
            $img_w = ! empty($thumbnail_custom['width']) ? $thumbnail_custom['width'] : '';
            $img_h = ! empty($thumbnail_custom['height']) ? $thumbnail_custom['height'] : '';
            $style_w_h = 'height:'.$img_h.'px';
        }
    }

    //tag列表页 或搜索页
    $is_tag_list_page=is_archive() && get_query_var('tag');
    if($is_tag_list_page || is_search()){
        $category_arrs = get_the_terms(get_the_ID(), 'category');
        if ( ! empty($category_arrs[0])) {
            $term_id = $category_arrs[0]->term_id;
            $thumbnail_custom = get_term_meta($term_id, 'thumbnail_px_custom', 'true');
            if(!empty($thumbnail_custom) && !empty($thumbnail_custom['height'])){
                $img_w = ! empty($thumbnail_custom['width']) ? $thumbnail_custom['width'] : '';
                $img_h = ! empty($thumbnail_custom['height']) ? $thumbnail_custom['height'] : '';
                $style_w_h = 'height:'.$img_h.'px';
            }
        }

    }

    ?>
    <div class="ceo_app_img">
    	<a href="<?php the_permalink(); ?>" <?php echo _target_blank();?> class="cover ceo-display-block ceo-overflow-hidden <?php if($post_has_video)echo 'post-has-video ' ?>">

            <?php
                if(!empty($my_post_video_options['video_url'])){
                    echo '<span></span>';
                }
            ?>
    	    <img src="<?php echo post_thumbnail_src($img_w,$img_h); ?>" alt="<?php the_title(); ?>" class="ceo-width-1-1@s" style="height: <?php if($is_tag_list_page){echo $img_h.'px';} ?>" >
    	</a>
	</div>
    <?php

    ?>
    <div class="ceo-padding-remove">
        <?php if(_ceo('ceo_cat_title') == true ): ?>
        <div class="card-title-desc">
            <a href="<?php the_permalink(); ?>" <?php echo _target_blank();?> class="title ceo-display-block" title="<?php the_title(); ?>">
                <?php if (is_sticky()): ?><i class="ceo-tops iconfont icon-brand-fill"></i><?php endif; ?><?php the_title(); ?>
            </a>
        </div>
        <?php endif; ?>
    </div>

    <?php if(_ceo('ceo_cat_tops') == true ): ?>
    <div class="ceo_freepath_subtitle">
        <!--分类-->
        <?php if(_ceo('ceo_cat_catfl') == true ): ?>
        <div class="ceo_freepath_zhujiang">
            <?php
			$category = get_the_category();
			if($category[0]){
				echo '<a href="'.get_category_link($category[0]->term_id ).'"><i class="fa fa-folder-open-o ceo-right-3"></i>'.$category[0]->cat_name.'</a>';
			} ?>
		</div>
		<?php endif; ?>
		<!--演示-->
		<?php if(_ceo('ceo_cat_demo') == true ): ?>
        <div class="ceo_freepath_keshi">
            <?php if(get_post_meta( get_the_ID(), 'down_demourl', true )){?>
                <a href="<?php echo get_post_meta( get_the_ID(), 'down_demourl', true );?>" target="_blank" rel="noreferrer nofollow" ceo-tooltip="<?php if(_ceo('ceoshop_single_an'))echo _ceo('ceoshop_single_an')['ceoshop_single_an_ys']; ?>">
                    <i class="iconfont icon-phone"></i>
                </a>
            <?php }?>
        </div>
        <?php endif; ?>
        <!--标签-->
        <div class="ceo_biaoqian">
        <?php get_template_part( 'template-parts/tese/custom', 'tese' ); ?>
        <?php if(_ceo('ceo_cat_tese') == true ): ?>
        <?php
        $tese_arr = get_post_meta( get_the_ID(), 'ceo_post_tese', true );
        if(!empty($tese_arr['ceo-tese-tag'])){
            $ymetaValue = $tese_arr['ceo-tese-tag'];
        }else{
            $ymetaValue='';
        }

        if (($ymetaValue=="remen")) {
            echo '<div class="ceo-tese-remen"><span class="i">#</span>热门</div>';
        }

        elseif (($ymetaValue=="dujia")) {
            echo '<div class="ceo-tese-dujia"><span class="i">#</span>独家</div>';
        }

        elseif (($ymetaValue=="zuixin")) {
            echo '<div class="ceo-tese-zuixin"><span class="i">#</span>最新</div>';
        }

        elseif (($ymetaValue=="tuijian")) {
            echo '<div class="ceo-tese-tuijian"><span class="i">#</span>推荐</div>';
        }

        elseif (($ymetaValue=="jingpin")) {
            echo '<div class="ceo-tese-jingpin"><span class="i">#</span>精品</div>';
        }

    	elseif (($ymetaValue=="buxuanze")) {
       	    echo '';
       	}
        ?>
        <?php endif; ?>
        </div>
    </div>
    <?php endif; ?>

	<?php if(_ceo('ceo_cat_foos') == true ): ?>
	<div class="ceo-padding-small card-foot ceo-card-foot">
		<div class="item-foot ceo-flex ceo-flex-middle">
			<div class="avatar ceo-flex-1 ceo-flex ceo-flex-middle">
		    <?php if(_ceo('ceo_cat_archive') == true ): ?>
				<?php echo get_avatar(get_the_author_meta( 'ID' ), 20); ?>
			<?php endif; ?>
		    <?php if(_ceo('ceo_cat_archive_t') == true ): ?>
				<span class="ceo-font-mini ceo-display-block ceo-margin-small-left"><?php the_author_posts_link(); ?></span>
			<?php endif; ?>
			</div>
			<div class="cat ceo-font-mini ceo-text-truncate">
			    <?php if(_ceo('ceo_cat_riqi') == true ): ?>
			    <span class="ceo-yc ceo-ycd ceo-display-inline-block ceo-flex ceo-flex-middle ceo-card-margin-left" ceo-tooltip="<?php the_time('Y-m-d') ?>" ><i class="iconfont icon-rili"></i> <?php  echo timeago(get_gmt_from_date(get_the_time('Y-m-d G:i:s'))); ?>
			    </span>
			    <?php endif; ?>
			    <?php if(_ceo('ceo_cat_views') == true ): ?>
				<span class="ceo-ycd ceo-display-inline-block ceo-flex ceo-flex-middle ceo-card-margin-left"><i class="iconfont icon-yanjing"></i> <?php post_views('', ''); ?>
				</span>
				<?php endif; ?>
				<?php if(_ceo('ceo_cat_jiage') == true ): ?>
				<?php
                if (get_post_meta(get_the_ID(), 'erphp_down', 1) && get_post_meta(get_the_ID(), 'erphp_down', 1) != 4) {
                    echo '<span class="ceoshop-price ceo-card-margin-left" style="color: #ff4800;"><i class="iconfont icon-credit-level"></i> ' .get_post_meta(get_the_ID(),'down_price',1).'</span>';
                } ?>
				<?php endif; ?>
			</div>
		</div>
	</div>
	<?php endif; ?>
</div>

