File: /home/dwauav0tm6jp/hosted/jeffreyjhart_com/wp-content/themes/skylab-old/page-classic-gallery.php
<?php
/**
* Template Name: Classic Gallery
* Description: A Page Template that adds a classic 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" class="clearfix">
<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
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="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 endif; // end if ( post_password_required() ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>