![在此处输入图片说明] [1]
“id =”post - “>
“rel =”bookmark“>
<div class="storyContent"><?php the_content(__('(more...)')); ?></div>
<?php if($counter%2 == 0){ echo "<div class='clear'></div>";} ?>
<?php $counter++; ?>
这是style.css
.floatRight {
浮动:右;
}
.floatLeft {
浮动:左;
}
.clear {
明确:两者;
}
我希望以这种方式显示我的帖子,请任何人帮忙解决这个问题。
POST1 POST2 post3 post4
答案 0 :(得分:0)
点击此链接,对您有所帮助
答案 1 :(得分:0)
如果你想选择浮动左/右,你可以这样做:
<p>
可以是任何内容...... <div>
... <table>
...
CSS
.pright{float:right;}
.pleft{float:left;}
HTML
<p class="pleft">
post1
thumbnail content
</hr>
</p>
<p class="pright">
post2
thumbnail content
</hr>
</p>
答案 2 :(得分:0)
<?php
$args = array( 'posts_per_page' => 10, 'offset'=> 1, 'category' => 1 );
$myposts = get_posts( $args );
$p=1;
foreach ( $myposts as $post ) {
$class = ($p%2 == 0) ? "float-right" : "float-left";
$p++;
// Use $class in the div class
}