1
我與合併引導WordPress的,我希望得到的東西是這樣的:WordPress的,博客頁面不顯示博客
1|
| 2
3|
我檢查是否有後(有3在那一刻)。接下來是循環,並顯示博客...但其顯示空箱...
我做錯了什麼? 或者也許有更好的方法來做到這一點?
<div class="wrapper">
<?php
$rest_query = new WP_Query(array(
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => array('post'),
'post_status' => 'publish'
));
if($rest_query->have_posts()):
?>
<?php while($rest_query->have_posts()): $rest_query->the_post(); ?>
<?php
if ($rest_query->current_post == 0)
{
echo '<div class="row">
<div class="col-md-6">
<div class="single first-post">
<a href="<?php the_permalink(); ?>"><div class="thumb"><?php the_post_thumbnail(); ?></div></a>
<div class="content">
<a href="<?php the_permalink(); ?>"><h1><?php the_title(); ?></h1></a>
<div class="data">
<p class="date"><?php echo get_the_date();s ?></p>
<p class="social">0 shares/0 comments</p>
</div>
</div>
</div>
</div>
<div class="middleLine"></div>
<div class="col-md-6"></div>
</div>';
}
elseif ($rest_query->current_post == 1)
{ echo '<div class="row">
<div class="col-md-6"></div>
<div class="middleLine"></div>
<div class="col-md-6">
<div class="single secound-post">
<a href="<?php the_permalink(); ?>"><div class="thumb"><?php the_post_thumbnail(); ?></div></a>
<div class="content">
<a href="<?php the_permalink(); ?>"><h1><?php the_title(); ?></h1></a>
<div class="data">
<p class="date"><?php echo get_the_date();s ?></p>
<p class="social">0 shares/0 comments</p>
</div>
</div>
</div>
</div>
</div>'; }
?>
<?php endwhile; ?>
<?php endif; ?>
</div>