<section id="section_album_photo" class="fw-main-row ">
<div class="fw-main-row-bg" style=" "></div>
<div class="fw-main-row-overlay has-color"></div>
<div style="" class="fw-container ">
<div class="fw-row">
<div class="fw-col-xs-12 ">
<div class="textblock-shortcode"><h2><?php echo $cat->name; ?></h2></div>
</div>
</div>
<?php
$args = array(
'post_type' => 'galerie_photo',
'cat' => $cat->term_id,
'posts_per_page' => -1,
);
$counter = 1;
$loop = new WP_Query( $args );
$count_loop = $loop->post_count;
while ( $loop->have_posts() ) : $loop->the_post();
//$photo_id = get_the_id();
$image = get_field('galerie_image');
?>
<?php if ($counter == 1) { ?>
<div class="fw-row">
<?php } ?>
<div class="fw-col-xs-12 fw-col-sm-3 ">
<div class="textblock-shortcode">
<?php if( get_field('galerie_credits') ){
$galerie_credits = '<small align="center">Photo par '.get_field('galerie_credits').'</small>';
}else{
$galerie_credits = '';
} ?>
<?php if( get_field('galerie_web_uniquement') == 1) {
$galerie_web_uniquement = '<small align="center">web uniquement</small>';
}else{
$galerie_web_uniquement = '';
} ?>
<?php if( get_field('galerie_titre_visible') ){
echo "<h3>".get_field('galerie_titre_visible')."</h3>";
} ?>
<?php echo do_shortcode( '[restrict userlevel="subscriber"]
<a href="'.$image["url"].'" rel="attachment wp-att-3974" target="_blank">
[/restrict]' ); ?>
<img src="<?php echo $image['sizes']['thumbnail']; ?>" width="150" height="150" class="alignnone size-thumbnail">
<?php echo do_shortcode( '[restrict userlevel="subscriber"]
</a>'.$galerie_credits.''.$galerie_web_uniquement.'[/restrict]' );
?>
</div>
</div>
<?php //echo $wp_query->post_count;
if (($counter % 4 == 0) && ($counter != $count_loop)){ ?>
</div>
<div class="fw-row">
<div class="fw-col-xs-12 ">
<div class="fw-divider-space" style="padding-top: 50px;"></div>
</div>
</div>
<div class="fw-row">
<?php } $counter +=1; ?>
<?php
endwhile;
?>
</div>
</div>
</section>