2016-08-21 8 views
0

私は、クライアント用に作成しているWordpressサイト用のJointsWPを使用しています。交替Wordpress投稿

投稿がループしているときに投稿を交互にしたいと考えています。

たとえば、POST1:左側に特徴画像、右側にタイトル/抜粋。 POST2:左のタイトル/抜粋、右の特徴画像その他

誰もがこれで運が見つかりましたか?

<?php 
$args = array('posts_per_page' => 2, 'offset' => 2,); 
$myposts = get_posts($args); 
foreach ($myposts as $post) : setup_postdata($post); ?> 
<div class="row"> 
<div class="large-6 columns"> 
<a href="<?php the_permalink(); ?>"> 
<?php the_post_thumbnail(); ?> 
</a> 
</div> 
<div class="large-6 columns"> 
<?php the_date(); ?> 
<a href="<?php the_permalink(); ?>"> 
<h3><?php the_title(); ?></h3> 
</a> 
<?php the_excerpt(); ?> 
</div> 
<div class="large-12 columns"> 
<hr> 
</div> 
</div> 

<?php endforeach; wp_reset_postdata();?> 
+1

'$ myposts'は連想配列かインデックス配列ですか? –

+0

これは連想配列として設定されています。 –

答えて