File: /home/dwauav0tm6jp/hosted/jeffreyjhart_com/wp-content/themes/skylab/single-portfolio.php
<?php
/**
* The Template for displaying single portfolio.
*
* @package WordPress
* @subpackage Skylab
* @since Skylab 1.0
*/
get_header(); ?>
<div id="main" class="clearfix">
<div id="primary">
<div id="content" class="clearfix" role="main">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
$project_url = get_post_meta( get_the_ID(), 'mega_portfolio_url', true );
$mediaType = get_post_meta( get_the_ID(), 'mega_portfolio_type', true );
$project_client = get_post_meta( get_the_ID(), 'mega_portfolio_client', true );
$project_date = get_post_meta( get_the_ID(), 'mega_portfolio_date', true );
$project_slideshow = get_post_meta( get_the_ID(), 'mega_portfolio_slideshow', true );
$slider_type = get_post_meta( $post->ID, 'mega_portfolio_slider_type', true );
$portfolio_slider_height = get_post_meta( $post->ID, 'mega_portfolio_slider_height', true );
if ( empty( $portfolio_slider_height ) ) {
$portfolio_slider_height = 603;
}
?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<div class="portfolio-media clearfix">
<?php switch( $mediaType ) {
case 'Images': ?>
<?php if ( $mediaType == 'Images' && $project_slideshow == 'Yes' ) { ?>
<?php
global $post;
if ( metadata_exists( 'post', $post->ID, '_portfolio_image_gallery' ) ) {
$portfolio_image_gallery = get_post_meta( $post->ID, '_portfolio_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() ) ) );
$portfolio_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $portfolio_image_gallery ) );
$thumbs = array();
if ( $attachments ) { ?>
<?php if ( $project_slideshow == 'Yes' ) { ?>
<?php if ( $slider_type == 'iosSlider' ) { ?>
<div id="carousel-gallery" class="container clearfix">
<div class="iosSliderContainer clearfix">
<div class="iosSlider clearfix">
<div class="slider clearfix">
<?php foreach ( $attachments as $attachment_id ) { ?>
<div class="item" data-attachment_id="<?php echo $attachment_id; ?>">
<?php $gallery_image = wp_get_attachment_image( $attachment_id, 'full' ); ?>
<?php echo $gallery_image; ?>
</div><!-- .item -->
<?php } ?>
</div><!-- .slider -->
<div class="iosNext"></div>
<div class="iosPrev iosUnselectable"></div>
</div><!-- .iosSlider -->
</div><!-- .iosSliderContainer -->
</div><!-- #carousel-gallery -->
<?php } else if ( $slider_type == 'Default' ) { ?>
<div id="gallery-slider" class="royalSlider default rsMinW clearfix" style="height: <?php echo $portfolio_slider_height; ?>px;">
<?php foreach ( $attachments as $attachment_id ) { ?>
<div class="rsContent" data-attachment_id="<?php echo $attachment_id; ?>">
<?php $gallery_image = wp_get_attachment_image( $attachment_id, 'full', false, $default_attr = array( 'class' => "rsImg") ); ?>
<?php echo $gallery_image; ?>
</div>
<?php } ?>
</div><!-- #gallery-slider -->
<?php } else { ?>
<div id="gallery-slider" class="royalSlider full-width rsMinW clearfix">
<?php foreach ( $attachments as $attachment_id ) { ?>
<div class="rsContent" data-attachment_id="<?php echo $attachment_id; ?>">
<?php $gallery_image = wp_get_attachment_image( $attachment_id, 'full', false, $default_attr = array( 'class' => "rsImg") ); ?>
<?php echo $gallery_image; ?>
</div>
<?php } ?>
</div><!-- #gallery-slider -->
<?php } ?>
<?php } ?>
<?php } else { ?>
<p class="no-found"><?php _e( 'No images found, please add some images.', 'mega' ); ?></p>
<?php } ?>
<?php } // End if ( $mediaType == 'Images' && $project_slideshow == 'Yes' ) ?>
<?php break;
case 'Video':
$youtubevimeo_url = get_post_meta(get_the_ID(), 'mega_youtube_vimeo_url', true);
$embed = get_post_meta(get_the_ID(), 'mega_video_embed_code', true);
$ratio_width = get_post_meta(get_the_ID(), 'mega_video_ratio_width', true);
$ratio_height = get_post_meta(get_the_ID(), 'mega_video_ratio_height', true);
$ratio = '';
if (!empty($ratio_width))
$ratio = ((int)$ratio_height / (int)$ratio_width * 100) .'%';
?>
<?php if ( !empty( $youtubevimeo_url ) ) {?>
<div class="fluid-video" <?php if (!empty($ratio)) echo 'style="padding-top:'.$ratio.';padding-bottom:0;"'; ?>>
<?php mega_get_video(get_the_ID(),1400,786); ?>
</div>
<?php } elseif ( $embed != '' ) { ?>
<div class="fluid-video" <?php if (!empty($ratio)) echo 'style="padding-top:'.$ratio.';padding-bottom:0;"'; ?>>
<?php echo stripslashes(htmlspecialchars_decode($embed));?>
</div>
<?php }
break;
case 'Audio':
$audio_embed_code = get_post_meta(get_the_ID(), 'mega_audio_embed_code', true);
?>
<?php if ( !empty( $audio_embed_code ) ) {?>
<div class="fluid-audio">
<?php echo stripslashes( htmlspecialchars_decode( $audio_embed_code ) ); ?>
</div>
<?php } else { ?>
<p class="no-found"><?php _e( 'No audio found, please add audio.', 'mega' ); ?></p>
<?php }
break;
default:
break;
} ?>
</div><!-- .portfolio-media -->
<div class="portfolio-content clearfix">
<div class="portfolio-description clearfix">
<header class="entry-header">
<h1 class="entry-title"><?php echo the_title();?></h1>
<?php $portfolio_page = ot_get_option( 'portfolio_page' ); ?>
<span class="nav-back"><a href="<?php echo get_permalink( $portfolio_page ); ?>"><?php _e( '← Back to the Portfolio', 'mega' ); ?></a></span>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
</div>
<div class="portfolio-meta clearfix">
<ul class="portfolio-details clearfix">
<?php if ( $project_date ) : ?>
<li><em><?php _e( 'Date', 'mega' ); ?>:</em> <span><?php echo $project_date; ?></span></li>
<?php endif; ?>
<?php if ( $project_client) : ?>
<li><em><?php _e( 'Client', 'mega' ); ?>:</em> <span><?php echo $project_client; ?></span></li>
<?php endif; ?>
<?php $portfolio_terms = get_the_terms( $post->ID, 'portfolio-category' );
$countTerms = 1;
if ( $portfolio_terms ) : ?>
<li class="portfolio-categories">
<em><?php _e( 'Filed under', 'mega' ); ?>:</em>
<?php foreach ( $portfolio_terms as $term ) {
if ( $countTerms == sizeof( $portfolio_terms ) ) echo '<span>'.$term->name. '</span>';
else echo '<span>' .$term->name. '</span>, ';
$countTerms ++;
}
?>
</li>
<?php endif;?>
<?php if ( $project_url ) : ?>
<li>
<em><?php _e( 'Link', 'mega' ); ?>:</em> <span><a href="<?php echo $project_url; ?>" target="_blank"><?php echo str_replace( 'http://','', $project_url ); ?></a></span>
</li>
<?php endif;?>
</ul>
<?php $portfolio_page = ot_get_option( 'portfolio_page' ); ?>
</div><!-- .portfolio-meta -->
</div><!-- .portfolio-description -->
<?php if ( $mediaType == 'Images' && $project_slideshow == 'No' ) { ?>
<?php
global $post;
if ( metadata_exists( 'post', $post->ID, '_portfolio_image_gallery' ) ) {
$portfolio_image_gallery = get_post_meta( $post->ID, '_portfolio_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() ) ) );
$portfolio_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $portfolio_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, 'full', false ); ?>
<?php $gallery_image_src = wp_get_attachment_image_src( $attachment_id, 'full' ); ?>
<?php $zoom = $gallery_image_src[0]; ?>
<?php $portfolio_lightbox = ot_get_option( 'portfolio_lightbox' ); ?>
<?php if ( is_singular( 'portfolio' ) && $mediaType == 'Images' && $project_slideshow == 'No' && ! empty( $portfolio_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 } ?>
<?php } ?>
<nav id="nav-single" class="clearfix">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'mega' ); ?></h3>
<?php if ( get_previous_post() ) : ?>
<span class="nav-next"><?php previous_post_link( '%link', __( 'Next project →', 'mega' ) ); ?></span>
<?php endif; ?>
<?php if ( get_next_post() ) : ?>
<span class="nav-previous"><?php next_post_link( '%link', __( '← Previous project', 'mega' ) ); ?></span>
<?php endif; ?>
</nav><!-- #nav-single -->
<?php $show_related_projects = ot_get_option( 'show_related_projects' ); ?>
<?php if ( ! empty( $show_related_projects ) ) { ?>
<?php $projects = get_related_projects( $post->ID ); ?>
<?php if ( $projects->have_posts () ) : ?>
<div class="related-projects-wrapper clearfix">
<div class="related-projects">
<?php while( $projects->have_posts () ): $projects->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?>>
<div class="content-wrapper">
<?php if ( has_post_thumbnail () ) : ?>
<div class="post-thumbnail clearfix">
<?php $portfolio_custom_url = get_post_meta( get_the_ID(), 'mega_portfolio_custom_url', true ); ?>
<a href="<?php if ( ! empty( $portfolio_custom_url ) ) echo $portfolio_custom_url; else the_permalink(); ?>" rel="bookmark">
<?php the_post_thumbnail( 'full' ); ?>
<div class="portfolio-view-wrapper">
<div class="portfolio-view">
<div class="portfolio-view-content">
<header class="entry-header">
<h2><?php the_title(); ?></h2>
</header><!-- .entry-header -->
<hr>
<?php //$portfolio_meta = ot_get_option( 'portfolio_meta' ); ?>
<?php //if ( $portfolio_meta == 'categories' ) { ?>
<?php echo custom_taxonomies_terms_links(); ?>
<?php //} ?>
</div>
</div>
</div>
</a>
</div>
<?php endif; ?>
</div><!-- .content-wrapper -->
</article><!-- #post-<?php the_ID(); ?> -->
<?php endwhile; ?>
</div><!-- .related-projects -->
</div><!-- .related-projects-wrapper -->
<?php endif; ?>
<?php } ?>
</div><!-- .portfolio-content -->
</div><!-- id="post-<?php the_ID(); ?>" -->
<?php endwhile; // end of the loop. ?>
<?php endif; ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>