Ajax Loader
×

Untitled

HTML
<?
1
<?
2
$i = 0;
3
foreach( $posts as $post ) {
4
// в каждом 1-м посту каждой четверки открываем див
5
if ($i % 4 === 0) {
6
echo '<div class="content_one_fourth">';
7
}
8
?>  
9
 
10
<div class="column">
11
    <? $img_post=wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail-post');?>
12
    <div class="post_img" style="background: url(<?=$img_post[0]?>);"></div>
13
    <a class="album_title" href="<?php the_permalink();?>"><?php the_title(); ?></a>
14
    <p class="artist_name"><?php the_field('album_artist'); ?></p>
15
    <p class="album_year"><?php the_field('album_year'); ?></p>
16
</div>
17
 
18
  
19
 
20
// в каждом 4-м посту каждой четверки закрываем див
21
<? if ($i % 4 === 3) {
22
echo '</div">';
23
}
24
 
25
$i++;
26
}
27
 
28
?>
29
// если в последней четверке не 4 поста, то див не закрыт. закрываем его
30
<? if ($i % 4 !== 0) {
31
echo '</div">';
32
}
33
?>
 

Untitled

CSSDeck G+