【发布时间】:2014-10-13 11:06:08
【问题描述】:
在父 ul 和子 ul 中实现 wordpress 循环是否正确? 我有一些问题,因为父母输出正确,但孩子不是。孩子的帖子标题仅在一个父 ul 中输出。
<ul class="multi-category">
<?php query_posts(array('post_type' => array('post'),'posts_per_page' => 3)); ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<li>
<h3>
<a href="<?php the_permalink(); ?>">Food</a></h3>
<div class="multi-category-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Fun creations with potatoes and rice">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail(420,470);
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/default-image.jpg" alt="<?php the_title(); ?>" />
<?php } ?></a>
<div class="multi-category-text">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</div><!--multi-category-text-->
</div><!--multi-category-image-->
<?php endwhile; // end of the loop. ?>
<?php endif; ?>
<div class="multi-category-headlines">
<ul class="multi-category-headlines">
<?php query_posts(array('post_type' => array('post'),'posts_per_page' => 4)); ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</li>
<?php endwhile; // end of the loop. ?>
<?php endif; ?>
</ul>
</div><!--multi-category-headlines-->
</li>
</ul>
【问题讨论】:
-
你的问题有点不清楚。你到底想做什么,解析这个还是生成这个?
-
您遇到了什么问题?
-
我很困惑如何在我的父母
- 和我的孩子
- 在 wordpress 帖子中插入循环