File: /home/dwauav0tm6jp/hosted/jeffreyjhart_com/wp-content/themes/skylab/single-gallery.php
<?php get_header(); ?>
<div id="main" class="clearfix">
<div id="primary">
<div id="content" role="main">
<header class="entry-header">
<h1 class="entry-title"><?php echo the_title();?></h1>
</header><!-- .entry-header -->
<?php if ( post_password_required() ) : ?>
<div class="password-protected">
<?php the_content(); ?>
</div>
<?php else : ?>
<?php $gallery_type = get_post_meta(get_the_ID(), 'mega_gallery_type', true); ?>
<?php // Slider ?>
<?php if ( $gallery_type == 'Slider' ) : ?>
<?php
global $post;
if ( metadata_exists( 'post', $post->ID, '_gallery_post_type_image_gallery' ) ) {
$gallery_post_type_image_gallery = get_post_meta( $post->ID, '_gallery_post_type_image_gallery', true );
} else {
// Backwards compat
$attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
$gallery_post_type_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $gallery_post_type_image_gallery ) );
$thumbs = array();
if ( $attachments ) { ?>
<div id="gallery-slider" class="royalSlider rsMinW clearfix">
<?php foreach ( $attachments as $attachment_id ) { ?>
<div class="rsContent" data-attachment_id="<?php echo $attachment_id; ?>">
<?php $gallery_image_src = wp_get_attachment_image_src( $attachment_id, 'full' ); ?>
<?php $gallery_image_thumb = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); ?>
<?php $attachment = get_post( $attachment_id ); ?>
<?php $attachment_title = apply_filters( 'the_title', $attachment->post_title ); ?>
<?php $attachment_caption = apply_filters( 'the_title', $attachment->post_excerpt ); ?>
<img class="rsImg" src="<?php echo $gallery_image_src[0]; ?>" width="<?php echo $gallery_image_src[1]; ?>" height="<?php echo $gallery_image_src[2]; ?>" alt="<?php echo $attachment_title; ?>" data-rsTmb="<?php echo $gallery_image_thumb[0]; ?>" />
<?php if ( ! empty( $attachment_caption ) ) { ?>
<span class="rsTitle rsABlock rsNoDrag rsAbsoluteEl" data-fade-effect="true" data-move-offset="0" data-move-effect="right" data-speed="350"><?php echo $attachment_caption; ?></span>
<?php } ?>
</div>
<?php } ?>
</div><!-- #gallery-slider -->
<?php } else { ?>
<p class="no-found"><?php _e( 'No images found, please add some images.', 'mega' ); ?></p>
<?php } // end if ( $attachments ) ?>
<?php // Full Width Slider ?>
<?php elseif ( $gallery_type == 'Full Width Slider' ) : ?>
<?php
$full_width_slider_title = get_post_meta( get_the_ID(), 'mega_full_width_slider_title', true );
if ( $full_width_slider_title == __( 'yes', 'mega') )
$full_width_slider_title = 'true';
else $full_width_slider_title = 'false';
global $post;
if ( metadata_exists( 'post', $post->ID, '_gallery_post_type_image_gallery' ) ) {
$gallery_post_type_image_gallery = get_post_meta( $post->ID, '_gallery_post_type_image_gallery', true );
} else {
// Backwards compat
$attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
$gallery_post_type_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $gallery_post_type_image_gallery ) );
$thumbs = array();
if ( $attachments ) { ?>
<div id="gallery-slider" class="royalSlider rsMinW clearfix">
<?php foreach ( $attachments as $attachment_id ) { ?>
<div class="rsContent" data-attachment_id="<?php echo $attachment_id; ?>">
<?php $gallery_image_src = wp_get_attachment_image_src( $attachment_id, 'full' ); ?>
<?php $gallery_image_thumb = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); ?>
<?php $attachment = get_post( $attachment_id ); ?>
<?php $attachment_title = apply_filters( 'the_title', $attachment->post_title ); ?>
<?php $attachment_caption = apply_filters( 'the_title', $attachment->post_excerpt ); ?>
<img class="rsImg" src="<?php echo $gallery_image_src[0]; ?>" width="<?php echo $gallery_image_src[1]; ?>" height="<?php echo $gallery_image_src[2]; ?>" alt="<?php echo $attachment_title; ?>" data-rsTmb="<?php echo $gallery_image_thumb[0]; ?>" />
<?php if ( ! empty( $attachment_caption ) ) { ?>
<span class="rsTitle rsABlock rsNoDrag rsAbsoluteEl" data-fade-effect="true" data-move-offset="0" data-move-effect="left" data-speed="2000"><?php echo $attachment_caption; ?></span>
<?php } ?>
</div>
<?php } ?>
</div><!-- #gallery-slider -->
<?php } else { ?>
<p class="no-found"><?php _e( 'No images found, please add some images.', 'mega' ); ?></p>
<?php } // end if ( $attachments ) ?>
<?php // Full Width of Window Slider ?>
<?php elseif ( $gallery_type == 'Full Width of Window Slider' ) : ?>
<?php
global $post;
if ( metadata_exists( 'post', $post->ID, '_gallery_post_type_image_gallery' ) ) {
$gallery_post_type_image_gallery = get_post_meta( $post->ID, '_gallery_post_type_image_gallery', true );
} else {
// Backwards compat
$attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
$gallery_post_type_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $gallery_post_type_image_gallery ) );
$thumbs = array();
if ( $attachments ) { ?>
<div id="gallery-slider" class="royalSlider rsMinW clearfix">
<?php foreach ( $attachments as $attachment_id ) { ?>
<?php $gallery_image_src = wp_get_attachment_image_src( $attachment_id, 'full' ); ?>
<?php $gallery_image_thumb = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); ?>
<?php $attachment = get_post( $attachment_id ); ?>
<?php $attachment_title = apply_filters( 'the_title', $attachment->post_title ); ?>
<?php $attachment_caption = apply_filters( 'the_title', $attachment->post_excerpt ); ?>
<div class="rsContent" data-attachment_id="<?php echo $attachment_id; ?>">
<img class="rsImg" src="<?php echo $gallery_image_src[0]; ?>" width="<?php echo $gallery_image_src[1]; ?>" height="<?php echo $gallery_image_src[2]; ?>" alt="<?php echo $attachment_title; ?>" data-rsTmb="<?php echo $gallery_image_thumb[0]; ?>" />
<?php if ( ! empty( $attachment_caption ) ) { ?>
<span class="rsTitle rsABlock rsNoDrag rsAbsoluteEl" data-fade-effect="true" data-move-offset="0" data-move-effect="left" data-speed="2000"><?php echo $attachment_caption; ?></span>
<?php } ?>
</div>
<?php } ?>
</div><!-- #gallery-slider -->
<?php } else { ?>
<p class="no-found"><?php _e( 'No images found, please add some images.', 'mega' ); ?></p>
<?php } // end if ( $attachments ) ?>
<?php // Masonry(No Margins) ?>
<?php elseif ( $gallery_type == 'Masonry(No Margins)' ) : ?>
<?php
global $post;
if ( metadata_exists( 'post', $post->ID, '_gallery_post_type_image_gallery' ) ) {
$gallery_post_type_image_gallery = get_post_meta( $post->ID, '_gallery_post_type_image_gallery', true );
} else {
// Backwards compat
$attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
$gallery_post_type_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $gallery_post_type_image_gallery ) );
$thumbs = array();
if ( $attachments ) { ?>
<div id="block-gallery-no-margins" class="<?php echo $photos_size_class; ?> clearfix">
<ul class="photos-gallery clearfix" id="gallery-<?php the_ID(); ?>">
<?php foreach ( $attachments as $attachment_id ) { ?>
<?php
$gallery_image_src = wp_get_attachment_image_src( $attachment_id, 'full' );
$zoom = $gallery_image_src[0];
$class = "media-image";
$gallery_image_title = esc_attr( get_the_title( $attachment_id ) );
?>
<li class="gallery-item <?php echo $class; ?>" data-attachment_id="<?php echo $attachment_id; ?>">
<a href="<?php echo $zoom; ?>" rel="external">
<?php $gallery_image_thumb = wp_get_attachment_image( $attachment_id, 'gallery-thumb-no-margins' ); ?>
<?php echo $gallery_image_thumb; ?>
<div class="entry-view-wrapper"></div>
</a>
</li>
<?php } ?>
</ul><!-- .photos-gallery -->
</div><!-- #block-gallery -->
<?php } else { ?>
<p class="no-found"><?php _e( 'No images found, please add some images.', 'mega' ); ?></p>
<?php } // end if ( $attachments ) ?>
<?php // FancyBox Gallery ?>
<?php elseif ( $gallery_type == 'FancyBox Gallery' ) : ?>
<?php if ( !empty( $post->post_content ) ) : ?>
<div class="page-content">
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; // end of the loop. ?>
</div>
<?php endif; ?>
<?php
$show_fancybox_title = get_post_meta( $post->ID, 'mega_fancybox_title', true );
if ( $show_fancybox_title == __( 'yes', 'mega' ) )
$show_fancybox_title = 'true';
else $show_fancybox_title = 'false';
global $post;
if ( metadata_exists( 'post', $post->ID, '_gallery_post_type_image_gallery' ) ) {
$gallery_post_type_image_gallery = get_post_meta( $post->ID, '_gallery_post_type_image_gallery', true );
} else {
// Backwards compat
$attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
$gallery_post_type_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $gallery_post_type_image_gallery ) );
$thumbs = array();
if ( $attachments ) { ?>
<div id="block-fancybox-gallery" class="clearfix">
<ul class="fancybox-gallery clearfix" id="gallery-<?php the_ID(); ?>">
<?php foreach ( $attachments as $attachment_id ) { ?>
<?php $gallery_image_src = wp_get_attachment_image_src( $attachment_id, 'full' ); ?>
<?php $zoom = $gallery_image_src[0]; ?>
<?php $class = "media-image"; ?>
<?php $attachment = get_post( $attachment_id ); ?>
<?php $attachment_title = apply_filters( 'the_title', $attachment->post_title ); ?>
<?php $gallery_image_thumb = wp_get_attachment_image( $attachment_id, 'fancybox-gallery-thumb' ); ?>
<?php $video_url = get_post_meta( $attachment_id, 'mega-attachment-video-url', true ); ?>
<?php $class = "media-image"; ?>
<?php if ( ! empty( $video_url ) ) { ?>
<?php $zoom = $video_url; ?>
<?php $class = "media-video"; ?>
<?php } ?>
<li class="fancybox-gallery-item <?php echo $class; ?>">
<a class="fancybox" href="<?php echo $zoom; ?>" rel="external" <?php if ( $show_fancybox_title == 'true' ) echo 'title="'. $attachment_title .'"'; ?>>
<?php echo $gallery_image_thumb; ?>
<div class="entry-view-wrapper">
<div class="entry-view">
<div class="entry-view-content">
<?php if ( ! empty( $video_url ) ) { ?>
<i class="icon-play"></i>
<?php } ?>
</div>
</div>
</div>
</a>
</li>
<?php } ?>
</ul><!-- .fancybox-gallery -->
</div><!-- #block-fancybox-gallery -->
<?php } else { ?>
<p class="no-found"><?php _e( 'No images found, please add some images.', 'mega' ); ?></p>
<?php } // end if ( $attachments ) ?>
<?php // Classic Gallery ?>
<?php elseif ( $gallery_type == 'Classic Gallery' ) : ?>
<?php
global $post;
if ( metadata_exists( 'post', $post->ID, '_gallery_post_type_image_gallery' ) ) {
$gallery_post_type_image_gallery = get_post_meta( $post->ID, '_gallery_post_type_image_gallery', true );
} else {
// Backwards compat
$attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
$gallery_post_type_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $gallery_post_type_image_gallery ) );
$thumbs = array();
if ( $attachments ) { ?>
<div id="project-images" class="clearfix">
<?php foreach ( $attachments as $attachment_id ) { ?>
<div class="project-image clearfix">
<?php $gallery_image = wp_get_attachment_image( $attachment_id, 'large', false ); ?>
<?php $gallery_image_src = wp_get_attachment_image_src( $attachment_id, 'full' ); ?>
<?php $zoom = $gallery_image_src[0]; ?>
<?php $gallery_lightbox = ot_get_option( 'gallery_lightbox' ); ?>
<?php if ( ! empty( $gallery_lightbox ) ) { ?>
<a href="<?php echo $zoom; ?>" class="mp" rel="external"><?php echo $gallery_image; ?></a>
<?php } else { ?>
<?php echo $gallery_image; ?>
<?php } ?>
<?php $array = wp_get_attachment_metadata( $attachment_id, true ); ?>
<?php $attachment = get_post( $attachment_id ); ?>
<?php $attachment_caption = apply_filters( 'the_title', $attachment->post_excerpt ); ?>
<?php if ( $attachment_caption ) : ?>
<figure><?php echo $attachment_caption; ?></figure>
<?php endif; ?>
</div><!-- .project-image -->
<?php } ?>
</div><!-- #portfolio-images -->
<?php } else { ?>
<p class="no-found"><?php _e( 'No images found, please add some images.', 'mega' ); ?></p>
<?php } // end if ( $attachments ) ?>
<?php if ( !empty( $post->post_content ) ) : ?>
<div class="page-content">
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; // end of the loop. ?>
</div>
<?php endif; ?>
<?php // Image Gallery ?>
<?php else : ?>
<?php if ( !empty( $post->post_content ) ) : ?>
<div class="page-content">
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; // end of the loop. ?>
</div>
<?php endif; ?>
<?php
$showtitle = get_post_meta( $post->ID, 'mega_photos_title', true );
$photos_size = get_post_meta( $post->ID, 'mega_photos_size', true );
if ( $showtitle == __( 'yes', 'mega' ) )
$showtitle = 'true';
else $showtitle = 'false';
if ( $photos_size == __( 'width', 'mega' ) )
$photos_size_class = 'fixed-width';
else $photos_size_class = 'fixed-height';
?>
<?php
global $post;
if ( metadata_exists( 'post', $post->ID, '_gallery_post_type_image_gallery' ) ) {
$gallery_post_type_image_gallery = get_post_meta( $post->ID, '_gallery_post_type_image_gallery', true );
} else {
// Backwards compat
$attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
$gallery_post_type_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $gallery_post_type_image_gallery ) );
$thumbs = array();
if ( $attachments ) { ?>
<div id="block-gallery" class="<?php echo $photos_size_class; ?> clearfix">
<ul class="photos-gallery clearfix" id="gallery-<?php the_ID(); ?>">
<?php foreach ( $attachments as $attachment_id ) { ?>
<?php
$gallery_image_src = wp_get_attachment_image_src( $attachment_id, 'full' );
$zoom = $gallery_image_src[0];
$class = "media-image";
$gallery_image_title = esc_attr( get_the_title( $attachment_id ) );
?>
<li class="gallery-item <?php echo $class; ?>" data-attachment_id="<?php echo $attachment_id; ?>">
<a href="<?php echo $zoom; ?>" rel="external" <?php if ( $showtitle == 'true' ) echo 'title="'. $gallery_image_title .'"'; ?>>
<?php
if ( $photos_size == __( 'width', 'mega' ) ) {
$gallery_image_thumb = wp_get_attachment_image( $attachment_id, 'gallery-thumb-fixed-width' );
} else {
$gallery_image_thumb = wp_get_attachment_image( $attachment_id, 'gallery-thumb' );
}
?>
<?php echo $gallery_image_thumb; ?>
<div class="entry-view-wrapper"></div>
</a>
</li>
<?php } ?>
</ul><!-- .photos-gallery -->
</div><!-- #block-gallery -->
<?php } else { ?>
<p class="no-found"><?php _e( 'No images found, please add some images.', 'mega' ); ?></p>
<?php } // end if ( $attachments ) ?>
<?php endif; // End if ( $gallery_type == 'Full Width Slider' ) ?>
<?php endif; // End if ( post_password_required() ) ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>