【问题标题】:wordpress - All posts wrapped in a divwordpress - 包含在 div 中的所有帖子
【发布时间】: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>

【问题讨论】:

    标签: php html wordpress


    【解决方案1】:

    这个怎么样?

    <?php
    query_posts('cat=5');
    while (have_posts()) : the_post();
    echo '<div class="post">';
    the_content();
    echo '</div>';
    endwhile;
    ?>
    

    【讨论】:

    • 不要混用html和php,风格很差
    猜你喜欢
    • 2014-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多