I have two rows to display posts in first row i have two posts image + content , image + content And in second row the post layout change means content + image , content + image can you solve this my problem this is my code :
<div class="main_blog_content">
<?php $arr = array(
'posts_per_page' => 4
);?>
<?php
$arrg_query = new WP_Query($arr);
if(have_posts() ) : while($arrg_query ->have_posts() ) : $arrg_query ->the_post();
foreach ($arr as $i):
$i++;
// one layout type
if($i%2 == 0):
?>
<div class="col-sm-6">
<div class="single_blog_area textwhite">
<div class="row">
<div class="col-sm-6 no-padding">
<div class="single_blog_img">
<?php the_post_thumbnail(); ?>
<!--<img src="<?php //echo get_bloginfo('template_url');?>/assets/images/blog1.jpg" alt="" />-->
</div>
</div>
<div class="col-sm-6 no-padding">
<div class="single_blog_text s_b_left">
<p>
<a href="<?php the_permalink();?>">
<?php the_category( ' ' ); ?></a>
</p> <h3>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?></a></h3>
<div class="separator2">
</div>
<?php $content = get_the_content(); ?>
<p>
<?php echo wp_trim_words($content, 43); ?>
</p>
<a href="<?php the_permalink(); ?>" class="read_more">Read More >></a>
</div>
</div>
</div>
</div>
</div>
<?php
// another layout type
else:?>
<div class="col-sm-6">
<div class="single_blog_area textwhite">
<div class="row">
<div class="col-sm-6 col-sm-push-6 no-padding">
<div class="single_blog_img">
<?php the_post_thumbnail(); ?>
<!--<img src="assets/images/blog3.jpg" alt="" />-->
</div>
</div>
<div class="col-sm-6 col-sm-pull-6 no-padding">
<div class="single_blog_text s_b_right">
<p>
<a href="<?php the_permalink();?>">
<?php the_category( ' ' ); ?></a>
</p>
<h3>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?></a>
</h3>
<div class="separator2">
</div>
<?php $content = get_the_content(); ?>
<p>
<?php echo wp_trim_words($content, 43); ?>
</p>
<a href="<?php the_permalink();?>" class="read_more">Read More >></a>
</div>
</div>
</div>
</div>
</div>
<?php endif;?>
<?php endforeach; ?>
<?php endwhile; endif; ?>
</div>
i send a image of posts that i want :
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745227002a4617507.html
评论列表(0条)