나는 슬라이더 (Filament Group Responsive Carousel)에서 가장 최근의 상위 4 개의 게시물을 표시하는 Wordpress 용 코드를 작성했습니다. 게시물을 표시하고 슬라이딩하는 등의 작업을 수행하지만 4 개의 슬라이더가 있으며 각 슬라이더에 4 개의 게시물이 있습니다. 코드의 일부를 WP_Query()
과 틀리게 배치해야합니다. 여기 내 코드입니다 :Wordpress, Slider의 최근 게시물
<div class="carousel slider carousel-slide" data-transition="slide" data-autoplay="" data-interval="5000" data-paginate="true">
<?php
$topNews = new WP_Query();
$topNews->query('showposts=4');
while ($topNews->have_posts()) : $topNews->the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php if (has_post_thumbnail()) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail('full');
} ?>
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr(sprintf(__('Permalink to %s', 'android_and_tea'), the_title_attribute('echo=0'))); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
</header>
</div>
<?php endwhile; ?>
</div>
내 질문에, 나는이 위치를 변경해야합니까 어떤 코드/변경/대신 4 개 슬라이더, 그것은는 4 가장 최근의 게시물과 함께 하나의 슬라이더를 표시 얻기 위해 추가/제거 가장 최근 게시물 4 개?
은 전체 회전 목마 슬라이드 DIV 페이지에 4 번 반복인가? –
@PhilippeBoissonneault 예. 그러나 내가 원하는 4 개의 게시물은 거기에 있으며 잘 작동합니다 (슬라이딩 및 모든 것). –
'while (have_posts) : the_post();'가 있으면이 코드 세트를 살펴보십시오 ... –