File: /home/dwauav0tm6jp/hosted/jeffreyjhart_com/wp-content/themes/skylab/page-gallery-fancybox.php
<?php
/**
* Template Name: Fancybox Gallery
* Description: A Page Template that adds a Fancybox gallery to pages
*
* @package WordPress
* @subpackage Skylab
* @since Skylab 1.0
*/
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 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, '_page_image_gallery' ) ) {
$page_image_gallery = get_post_meta( $post->ID, '_page_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() ) ) );
$page_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $page_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 endif; // end if ( post_password_required() ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>