我正在尝试将帖子组织成三列,但我无法让它发挥作用。我只想在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
答案 0 :(得分: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>