【发布时间】:2013-12-29 10:58:11
【问题描述】:
我想在网页上显示所有帖子,每个帖子都应包含在 class="post" 的 div 中。我必须在哪里添加循环中的 HTML?
PHP
<?php
query_posts('cat=5');
while (have_posts()) : the_post();
the_content();
endwhile;
?>
HTML
<div class="post"></div>
【问题讨论】:
我想在网页上显示所有帖子,每个帖子都应包含在 class="post" 的 div 中。我必须在哪里添加循环中的 HTML?
PHP
<?php
query_posts('cat=5');
while (have_posts()) : the_post();
the_content();
endwhile;
?>
HTML
<div class="post"></div>
【问题讨论】:
这个怎么样?
<?php
query_posts('cat=5');
while (have_posts()) : the_post();
echo '<div class="post">';
the_content();
echo '</div>';
endwhile;
?>
【讨论】: