<?php
/*
  Template Name: Gallery
 */

get_header();
global $post;
$gallery_thumbnail_width = 313;
$gallery_thumbnail_height = 220;
$gallery_hide_filter = ThemeMakersThemeModel::get_option('gallery_hide_filter');


?>




<div class="title-caption-large">
    <h3><?php _e("Galleries", THEMEMAKERS_THEME_FOLDER_NAME) ?></h3>
</div><!--/ .title-caption-large-->


<!-- ************ - Gallery - ************** -->


<!-- ************ - Filter  - ************** -->
<?php $terms = get_terms('cons', 'orderby=name'); ?>
<?php if (!$gallery_hide_filter): ?>
    <div class="splitter-wrap">
        <ul id="filter" class="splitter">
            <li class="active">
                <a href="javascript:void(0);" data-rel="everyone" title="<?php _e("All", THEMEMAKERS_THEME_FOLDER_NAME) ?>"><?php _e("All", THEMEMAKERS_THEME_FOLDER_NAME) ?></a></li>            
            <?php foreach ($terms as $term) : ?>
                <li><a href="javascript:void(0);" data-rel="<?php echo $term->slug; ?>" title="<?php echo $term->name; ?>"><?php echo $term->name; ?></a></li>
            <?php endforeach; ?>
        </ul><!--/ splitter-->
        <div class="clear"></div>
    </div><!--/ splitter-wrap-->
<?php endif; ?>
<!-- ************ - END Filter  - ************** -->
<div id="grid-wrapper">
    <ul id="gallery" class="image-grid">
        <?php
        query_posts(array(
            'post_type' => 'gall',
            'showposts' => -1
        ));

        if (have_posts()) : while (have_posts()) : the_post();
                $terms = wp_get_post_terms($post->ID, 'cons');
                if (has_post_thumbnail()) {
					$video = get_post_meta($post->ID, 'thememakers_gallery_video', true);
					if ($video['0']!=''){
							$icon='video-icon';
						}
					else {
							$icon='picture-icon';
					}
                    ?>
                    <li id="id-<?php echo $post->ID; ?>" class="everyone <?php echo $icon; ?> <?php foreach ($terms as $term) echo $term->slug . ' '; ?>">
                        <a href="<?php echo get_permalink($post->ID) ?>">
                            <img src="<?php echo ThemeMakersHelper::get_post_featured_image($post->ID, 'gallery_thumb'); ?>" width="<?php echo $gallery_thumbnail_width ?>" height="<?php echo $gallery_thumbnail_height ?>" alt="" title="" />
                        <span class="curtain"> </span>
						</a>
						
                    </li>
                    <?php
                } else {
                    ?>
                    <li id="id-<?php echo $post->ID; ?>" class="everyone picture-icon <?php foreach ($terms as $term) echo $term->slug . ' '; ?>">
                        <a href="<?php echo get_permalink($post->ID) ?>">
                            <img src="<?php echo THEMEMAKERS_THEME_URI . '/images/no_img_220x140.gif' ?>" width="<?php echo $gallery_thumbnail_width ?>" height="<?php echo $gallery_thumbnail_height ?>" alt="" title="" />
                        <span class="curtain"> </span>
						</a>
                    </li>
                    <?php
                }
            endwhile;
        endif;
        wp_reset_query();
        ?>
    </ul><!--/ gallery-->

    <div class="clear"></div>
</div><!-- / grid-wrapper -->
<!-- ************ - END Gallery - ************** -->


<div class="clear"></div>
<?php get_footer(); ?>

