<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'post',
'posts_per_page' => 7,
'paged' => $paged);
$wp_query = new WP_Query($args);
$count = 0;
while (have_posts()) : the_post(); ?>
<?php echo get_the_title(); ?>
<?php
$count++;
if ($count === 1) { ?>
<div class="column small-12 margin-bottom-small">
<div class="panel-brown">
<img src="" alt="" />
<h5 class="heading-white"><a href="#"><?php echo get_the_title(); ?></a></h5>
<div class="para-white">
<?php $content = get_the_content(); echo mb_strimwidth($content, 0, 200, '...');?>
</div>
</div>
</div>
<?php }
while ($count <= 2) {
$count++ ?>
<div class="column small-12 medium-6 margin-bottom-small">
<div class="panel-tan">
<h5 class="heading-white"><a href="#"><?php echo get_the_title(); ?></a></h5>
<div>
<?php $content = get_the_content(); echo mb_strimwidth($content, 0, 200, '...');?>
</div>
</div>
</div>
<?php }
while ($count <= 4) {
$count++ ?>
<div class="column small-12 medium-6 margin-bottom-small">
<div class="panel-tan">
<h5 class="heading-white"><a href="#"><?php echo get_the_title(); ?></a></h5>
<div>
<?php $content = get_the_content(); echo mb_strimwidth($content, 0, 200, '...');?>
</div>
</div>
</div>
<?php }
?>
<?php endwhile; ?>
<!-- Pagination links -->
<?php next_posts_link('← Older posts', $wp_query ->max_num_pages); ?>
<?php previous_posts_link('Newer posts →'); ?>
왜 여부와 문은 같은 게시물을 반복하지만 동안 직접이 줄 끝에서 나는PHP - 동일한 포스트 대신 다음 게시물의 게재되고 이해하기 위해 사투를 벌인거야
while (have_posts()) : the_post();
제목을 되풀이하여 대신 게시물 목록을 표시합니다. 내가 여기 달성하기 위해 노력하고 무엇
루프에서 출력되는 각 게시물에 대해 다른 HTML 레이아웃을 만들 수 있습니다.
건배
당신이 첫 번째 문을 의미합니까 당신의 노력들에 대한
감사합니다''$ 동안> = 2'를 계산? if 문은 모두 if 문이어야합니다. 또한 메인 루프에서 WP_Query의 결과를 어떻게 사용하고 있는지 보지 못했을 것입니다 ... 아마도 손에있는 문제 – Chizzle