<?php get_header(); global $gp; ?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>		
			
	<?php gp_page_header( get_the_ID() ); ?>

	<div id="content-wrapper"<?php if ( $GLOBALS['gp_layout'] != 'gp-fullwidth' ) { ?> class="gp-container"<?php } ?>>

		<div id="content">

			<article <?php post_class( 'post-content' ); ?>>
	
				<header class="entry-header small-header">

					<h1 class="entry-title"><?php the_title(); ?></h1>

					<?php if ( ! empty( $gp['post_subtitle'] ) ) { ?>
						<h2 class="subtitle"><?php echo esc_attr( $gp['post_subtitle'] ); ?></h2>
					<?php } ?>

					<?php get_template_part( 'lib/sections/entry', 'meta' ); ?>

					<?php if ( ! empty( $gp['post_share_icons'] ) ) { ?>
						<div class="share-icons"><?php echo do_shortcode( $gp['post_share_icons'] ); ?></div>
					<?php } ?>

				</header>
		
				<div class="entry-content">

					<?php if ( has_post_thumbnail() && $GLOBALS['gp_featured_image'] == 'enabled' && get_post_format() == '0' ) { ?>

						<div class="post-thumbnail featured-content <?php echo sanitize_html_class( $GLOBALS['gp_image_alignment'] ); ?>">

							<?php $image = aq_resize( wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ), $GLOBALS['gp_image_width'], $GLOBALS['gp_image_height'], $GLOBALS['gp_hard_crop'], false, true ); ?>
							<?php if ( $gp['retina'] == 'gp-retina' ) {
								$retina = aq_resize( wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ), $GLOBALS['gp_image_width'] * 2, $GLOBALS['gp_image_height'] * 2, $GLOBALS['gp_hard_crop'], true, true );
							} else {
								$retina = '';
							} ?>

							<img src="<?php echo esc_url( $image[0] ); ?>" data-rel="<?php echo esc_url( $retina ); ?>" width="<?php echo absint( $image[1] ); ?>" height="<?php echo absint( $image[2] ); ?>" alt="<?php if ( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) { echo get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ); } else { the_title_attribute(); } ?>" class="wp-post-image" />
	
						</div>

					<?php } ?>	

					<?php get_template_part( 'lib/sections/entry', get_post_format() ); ?>

					<?php if ( get_post_format() == '0' OR get_post_format() == 'audio' OR (get_post_format() == 'gallery' && ! has_shortcode( $post->post_content, 'gallery' ) ) OR get_post_format() == 'link' OR get_post_format() == 'video' ) { ?>

						<div class="post-item-content <?php echo sanitize_html_class( $GLOBALS['gp_image_alignment'] ); ?>"><?php the_content(); ?></div>

					<?php } ?>
	
					<?php wp_link_pages( 'before=<ul class="page-numbers single-nav">&pagelink=<span class="page-numbers">%</span>&after=</ul>' ); ?>		
		
				</div><!-- END ENTRY CONTENT -->

				<?php if ( $gp['post_meta']['tags'] == '1' ) { ?>
					<?php the_tags( '<div class="entry-meta meta-tags">', ' ', '</div>' ); ?>
				<?php } ?>

				<?php if ( $gp['post_author_info'] == 'enabled' ) { ?>
					<?php get_template_part( 'lib/sections/author', 'info' ); ?>
				<?php } ?>

				<?php if ( $gp['post_related_items'] == 'enabled' ) { ?>
					<?php get_template_part( 'lib/sections/related', 'items' ); ?>
				<?php } ?>

				<?php comments_template(); ?>

			</article><!-- END ARTICLE -->

		</div><!-- END CONTENT -->

		<?php get_sidebar(); ?>

	</div><!-- END CONTENT WRAPPER -->

<?php endwhile; endif; ?>	
	
<?php get_footer(); ?>