【问题标题】:Add content between Wordpress queried posts在 Wordpress 查询的帖子之间添加内容
【发布时间】:2009-10-09 20:24:43
【问题描述】:

我想知道如何通过这种方法在 Wordpress 中查询的帖子之间添加一些内容:

    <?php $the_query = new WP_Query('category_name=name&showposts=2');
while ($the_query->have_posts()) : $the_query->the_post();?>

有没有一种方法可以让我添加一些简单的东西,比如在被拉出的两个帖子之间添加一个&lt;hr&gt;

【问题讨论】:

    标签: php wordpress


    【解决方案1】:
     <?php $the_query = new WP_Query('category_name=name&showposts=2');
     while ($the_query->have_posts())
     {
     $the_query->the_post();
     echo '<hr />';
     }
     ?>
    

    【讨论】:

    • 感谢您的回复.. 但是现在它只显示一篇上面有水平规则的帖子
    • 我怀疑。唯一的变化是 php 代码现在在块中。不影响帖子的数量或任何东西。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多