while (have_posts()) {
    the_post();
    ?>
			<article id="entry-<?php 
    the_ID();
    ?>
" <?php 
    post_class('entry');
    ?>
>
				<?php 
    $location = get_post_meta(get_the_ID(), 'ci_cpt_gallery_location', true);
    $caption = get_post_meta(get_the_ID(), 'ci_cpt_gallery_caption', true) == 'on' ? true : false;
    $columns = get_post_meta(get_the_ID(), 'ci_cpt_gallery_cols', true);
    $masonry = get_post_meta(get_the_ID(), 'ci_cpt_gallery_masonry', true);
    $thumbs = ci_featgal_get_attachments();
    $thumb_size = 1 == $columns ? 'ci_blog_full' : 'post-thumbnail';
    $div_class = '';
    if ('on' == $masonry) {
        $div_class = 'list-masonry';
        if ($columns > 1) {
            $thumb_size = 'ci_masonry';
        }
    }
    $item_classes = '';
    switch ($columns) {
        case 1:
            $item_classes = 'col-xs-12';
            break;
        case 2:
            $item_classes = 'col-xs-12 col-sm-6';
					</div>


					<ul id="tp-grid" class="tp-grid">
						<?php 
    $args = array('post_type' => 'cpt_gallery', 'posts_per_page' => -1);
    $q = new WP_Query($args);
    ?>

						<?php 
    while ($q->have_posts()) {
        $q->the_post();
        ?>
							<?php 
        $gallery_title = get_the_title();
        $thumbs = ci_featgal_get_attachments(get_the_ID());
        $gallery_id = get_the_ID();
        $caption = get_post_meta(get_the_ID(), 'ci_cpt_gallery_caption', true) == 'on' ? true : false;
        ?>
							<li data-pile="<?php 
        echo $gallery_title;
        ?>
">
								<a class="zoom" data-rel="prettyPhoto[<?php 
        echo $gallery_id;
        ?>
]" href="<?php 
        echo ci_get_featured_image_src('large');
        ?>
">
									<figure class="item-thumb">