这是我目前的代码。我想只在有多个相关的帖子缩略图时显示下一个和之前的控件。我尝试了一些东西,但没有任何东西让我到达我想要的地方。请帮忙:
$recent_posts_query = new WP_Query($args);
if($recent_posts_query->have_posts()):
echo '<div class="recipes-slider-widget cs">
<h2 class="w-bot-border">';
echo $title;
echo '</h2>
<ul class="cycle-slideshow" data-cycle-fx=scrollHorz data-cycle-timeout=0 data-cycle-slides="li" data-cycle-next=".n'.$widget_idc.'" data-cycle-prev=".p'.$widget_idc.'">';
while($recent_posts_query->have_posts()):
$recent_posts_query->the_post();
?>
<?php
if(has_post_thumbnail())
{
?>
<li>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('recipe-slider-widget'); ?>
</a>
<p class="info-box"><?php the_title() ?></p>
</li>
<?php
}
?>
<?php
endwhile;
echo ' </ul>
<span class="prev p'.$widget_idc.'"></span>
<span class="next n'.$widget_idc.'"></span>
</div>';
echo $after_widget;
endif;
}