首先,您应该对模板文件进行一些改进。尝试以下操作:
<?php get_header(); ?>
<?php global $woo_options; ?>
<?php if ( $woo_options[\'woo_featured_disable\'] <> "true" ) include( TEMPLATEPATH . \'/includes/featured.php\'); ?>
<?php
$args = array(
\'post_type\' => \'infobox\',
\'order\' => \'DESC\', // DESC for newer first.
\'orderby\' => \'date\',
\'posts_per_page\' => 6 // For a 3x2 grid.
);
$latest = new WP_Query( $args ); // You now have an object you can use in \'The Loop\'.
if ( $latest->have_posts() ) {
while ($latest->have_posts()) : $latest->the_post(); ?>
<div class="bskhp_t">
<a href="<?php echo get_post_meta($post->ID, \'mini_readmore\', true); ?>">
<img src="<?php echo get_post_meta($post->ID, \'mini\', true); ?>" alt="" class="home-icon">
</a>
<div class="bskhp_f">
<a href="<?php echo get_post_meta($post->ID, \'mini_readmore\', true); ?>">
<h3><?php the_title(); ?></h3>
</a>
<p><?php echo get_post_meta($post->ID, \'mini_excerpt\', true); ?></p>
<a href="<?php echo get_post_meta($post->ID, \'mini_readmore\', true); ?>">
<span>Read more</span>
</a>
</div>
</div>
<?php endwhile;
}
我删除了CSS,因为您应该将其移动到另一个文件中。
然后,对于3x2网格,我建议您使用CSS。尝试:
.bskhp_t {
display: inline-block;
width: 30%;
}
如果的父容器
.bskhp_t
DIVs采用所有可用宽度。
我没有测试此代码,所以如果您有一些问题,请告诉我;)