$colors = array('color-1' => '0', 'color-2' => '9', 'color-3' => '10', 'color-4' => '8'); foreach ($colors as $color => $tag_ids) { if (strpos($tag_ids, strval($tag_id)) !== FALSE) { return $color; } } return array_keys($colors)[0]; } ?> <?php foreach ($posts as $post) { ?> <div class="col-4 ganhuo1"> <dl> <dd><img src="<?php echo get_attachment_image_thumbnail(get_the_ID(), 'poster', array(370, 185)); ?> "><?php $tags = wp_get_post_tags(get_the_ID()); $tag = array_shift($tags); ?> <span class="<?php echo get_tag_color($tag->term_id); ?> "><?php echo $tag->name; ?> </span></dd> <dt> <p><a href="<?php the_permalink();
<h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <p><?php echo get_post_meta(get_the_ID(), 'summary', true); ?> </p> <div class="bDSIcon"><i class="bDSIcon1"></i><i class="bDSIcon2"></i></div> </div> <div class="col-bL3"> <?php $image = get_attachment_image_thumbnail(get_the_ID(), 'poster', array(270, 135)); ?> <img src="<?php echo $image; ?> " alt=""> </div> </div> <?php } ?> <?php $total_page = $the_query->max_num_pages; ?> <?php if ($total_page > 1) {