我是新來的WP和少量與自定義後循環內部div,這裏是我的代碼可以有人結構我砍在div。只有3個帖子應該在signle行中,但是journey_gallery_content只會重複,journey_gallery_row 不會重複。WordPress的自定義帖子div不正確的循環
<div class="journey_gallery_row">
<?php
$loop=new WP_Query(array('post_type'=>'journeypackage',
'sort_column' => 'post_date',
'posts_per_page'=> -1 ,
'order' => 'ASC')
);
if ($loop->have_posts())
{
while ($loop->have_posts())
{
$loop->the_post();
$meta=get_post_meta(get_the_id(),'');
?>
<div class="journey_gallery_content">
<?php echo get_the_post_thumbnail(); ?>
<div class="journey_package">
<div class="journey_package_img">
<?php
$attachment_id = get_field('package-icon');
$size = "et-member-image-small";
$image = wp_get_attachment_image_src($attachment_id, $size);
?>
<img src="<?php echo $image[0]; ?>" />
</div>
<div class="journey_package_name">
<a href="<?php bloginfo('url')?>/journeytitle/enture/"><?php echo get_the_title(); ?></a>
<p class ="">Date : <?php the_field('package-date'); ?> </p>
</div>
</div>
</div>
<?php }
}?>
</div>
</div>
</div>
</div>
我用你的答案得到了確切的結果。 –