<?php
/**
 * Default file for single staff posts
 * @package Ultra WordPress Theme
 * @since 1.0
 * @author AJ Clarke : http://wpexplorer.com
 * @copyright Copyright (c) 2012, AJ Clarke
 * @link http://wpexplorer.com
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */
 
get_header(); // Loads the header.php template
if ( have_posts() ) :
	while ( have_posts() ) : the_post();
	
	// Show heading area unless disabled
	if ( get_post_meta( get_the_ID(), 'wpex_page_disable_heading', true ) !== 'yes' ) {
		$posttype_obj = get_post_type_object( get_post_type( ) ); ?>
		<header id="page-heading">
			<div class="boxed">
				<h1>
				<?php the_title();
					if( get_post_meta( get_the_ID(), 'wpex_staff_position', true ) !=='' ) {
						echo '<div id="staff-post-position"><span class=" icon-angle-right"></span>' . get_post_meta( get_the_ID(), 'wpex_staff_position', true ) .'</div>'; 
					} ?>
				</h1>
				<?php
				// Yoast Breadcrumbs Support
				if( function_exists('yoast_breadcrumb') ) yoast_breadcrumb('<div id="breadcrumbs"><span class="icon-home"></span>','</div>'); ?>
				<ul id="post-pagination" class="clearfix">
					<?php next_post_link('<li class="post-prev">%link</li>', '<span class="icon-arrow-left"></span>', false); ?>
						<li class="postype-main"><a href="<?php echo get_post_type_archive_link( $post->post_type ); ?>" title="<?php echo $posttype_obj->label; ?>"><span class="icon-th-large"></span></a></li>
					<?php previous_post_link('<li class="post-next">%link</li>', '<span class="icon-arrow-right"></span>', false); ?>
				</ul><!-- #post-pagination -->
			</div><!-- /boxed -->
		</header><!-- /page-heading -->
	<?php } ?>
	
		<article id="single-post-wrap" class="staff-post container boxed clearfix"> 
			<div id="post">
				<?php
				// Get Staff Media
				get_template_part( 'content', 'staff' ); ?>	
				<div class="staff-post-text clearfix">
					<div class="staff-entry-content entry">
						<?php the_content(); ?>
						<?php wp_link_pages( array( 'before' => '<div class="page-links clearfix">', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
					</div><!-- .staff-post-content -->
				</div><!-- .staff-post-text --> 
				<?php
				// Show comments
				if ( of_get_option('staff_comments','') == '1' ) {
				comments_template();
				} ?>
			</div><!-- #post -->
			<?php
			// Load sidebar if post isn't full-width
			if( get_post_meta(get_the_ID(), 'wpex_post_layout', true ) !== 'Full Width' ) {
				get_sidebar();
			} ?>
			
		</article><!-- .staff-post -->
	
	<?php
	endwhile;
endif;

// Show other portfolio items
if ( ! post_password_required() ) {
	get_template_part('content-staff','related'); // Show other Staff items ( if post is not pass protected )
}

get_footer(); // Loads the footer.php file