我不知道为什么这个节目没有全部播出。当书籍下有6个以上的帖子时需要显示。
<?php
for($k=0;$k<count($results);$k++){
$ID = $results[$k][\'book_id\'];
$args = array(\'p\' => $ID, \'post_type\' => \'attraction\');
$loop = new WP_Query($args);
$book_img = get_the_post_thumbnail( $ID, \'medium\', array( \'class\' => \'alignleft\' ) );
if ($book_img) {
//NOTHING TO SHOW
}
}
?>
<?php
$args = array(
\'post_type\' => \'book\',
\'showposts\'=> 6,
\'tax_query\' => array(
array(
\'taxonomy\' => \'destinations\',
\'terms\' => $current_term->term_id,
)
)
);
$books = new WP_Query($args);
echo \'<ul class="discover-books country-details">\';
if ( $books->have_posts() ) {
while ( $books->have_posts() ) : $books->the_post();
$book_img = get_the_post_thumbnail( get_the_ID(), \'medium\', array( \'class\' => \'alignleft\' ) );
echo \'<li class="discover-single-box"><span class="discover-cell imageFit dimensions_img"><a href="\'.get_permalink().\'">\'.$book_img.\'</a><span class="bottom-content"><a href="\'.get_permalink().\'">\'.get_the_title().\'</a></span> </span></li>\';
endwhile;
}
echo \'</ul>\';
if(count($results) > 6) {
echo \'<div class="show-more"><a href="\'.get_site_url().\'/book?id=\'.base64_encode($current_term->term_id).\'">SHOW ALL</a></div>\';
}
?>