0

我正在尝试将帖子组织成三列,但无法正常工作。我只想在 3 个不同的列中显示 3 个帖子。

所以

1 | 2 | 3

到目前为止我所拥有的:

<div id="main-wrapper">

<?php 
  $loop = new WP_Query(array('post_type' => 'camp', 'posts_per_page' => 3)); 
  if ($loop->have_posts()) ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <?php   
    $custom = get_post_custom($post->ID);
    $screenshot_url = $custom["screenshot_url"][0];
    $website_url = $custom["website_url"][0];
?>


 <?php the_content(); ?>


<?php endwhile; ?>


</div>

网站是Botkai

4

1 回答 1

0

可以通过在父级内部创建另一个 DIV 轻松完成

<div id="main-wrapper">

<?php 
  $loop = new WP_Query(array('post_type' => 'camp', 'posts_per_page' => 3)); 
  if ($loop->have_posts()) ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <div style="float: left;"> <!-- or other class that contains this CSS property, including width etc. -->
      <?php   
        $custom = get_post_custom($post->ID);
        $screenshot_url = $custom["screenshot_url"][0];
        $website_url = $custom["website_url"][0];
      ?>
    </div>


<?php endwhile; ?>


</div>
于 2013-03-01T23:05:56.120 回答