【发布时间】:2017-03-07 20:08:55
【问题描述】:
我正在显示帖子的提要,其中一些帖子使用相同的背景图片。我想找到并隐藏重复的。
完整代码:
<?php
$args=array(
'cat' => '1',
'post_status' => 'publish',
'post_type' => 'post',
'posts_per_page' => 10,
'taxonomy' => 'postkicker',
'term' => 'vote',
'orderby' => 'date',
'order' => 'DESC'
);
$my_query = new WP_Query($args);
if ( $my_query->have_posts() ) :
while ( $my_query->have_posts() ) : $my_query->the_post();
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 284,110 ), false, '' );
?>
<div class="divider-left">
<a class="img-thumbnew" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<div style="background-image: url(<?php echo $src[0]; ?> );"></div>
</a>
</div>
【问题讨论】:
标签: php jquery duplicates background-image