0

我正在努力按照我想要的方式循环我的 WordPress 网站中的博客文章。

我希望帖子看起来像这样

截图1

但由于我必须循环的方式,它们会像这样出来

截图2

这是我正在使用的代码 - 我从一个空白主题开始并从那里建立

  <section class="blog-posts col-2-3 grid-pad">

    <?php while (have_posts()) : the_post(); ?>

      <article class="module">

      <li class="postWrapper" id="post-<?php the_ID(); ?>">

        <h2 class="postTitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
        <small><?php the_date(); ?> by <?php the_author(); ?></small>

        <div class="post"><?php the_content(__('(more...)')); ?></div>
      </li>



      <?php endwhile; ?>

    </article>

  </section>

<?php else: ?>

 <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>

<?php

endif;
?>

<?php if (will_paginate()): ?>

<ul id="pagination">
  <li class="previous"><?php posts_nav_link('','','&laquo; Previous Entries') ?></li>
  <li class="future"><?php posts_nav_link('','Next Entries &raquo;','') ?></li>
</ul>

<?php endif; ?>
</div> <!--END div.grid -->
</div> <!--END div.page-wrap -->
<?php
get_footer();
?>

我对 WP 非常了解,所以我很难理解循环是如何工作的,理论上每篇博文都应该是一个module所以每一篇已知的博文都是一个新模块。就我而言,正在发生的事情是每篇博客文章都添加到最后一次创建长模块的底部。

4

1 回答 1

1

很难确定这是否会在不了解您的完整 HTML/CSS 的情况下解决您的问题,但我确实看到您</article><?php endwhile; ?>

于 2013-02-05T19:28:22.830 回答