<div class="home-gallery">
<?php $gallery = new WP_Query (array('post_type' => 'gallery', 'posts_per_page' => 6, ));
    if($gallery -> have_posts() ):
        while($gallery -> have_posts() ) : $gallery -> the_post();
            $image_id = get_post_thumbnail_id();
            $image_url = wp_get_attachment_image_src($image_id,350,350);
            $image_url = $image_url[0]; ?>
            <a href="<?php echo "$image_url"; ?>" class="item lightbox" rel="lightbox" data-lightbox="roadtrip" style="background: url(<?php echo "$image_url"; ?>);"></a>
        <?php wp_reset_query();
        endwhile;
    else : ?>
        <h2><?php  _e('IMG NOT FOUND', 'igor'); ?></h2>
    <?php endif; ?>
</div>
