<?php
/**
 * The Template for displaying a single person.
 *
 * @package WordPress
 * @subpackage ChurchThemes
 *
 ===================================================================================================
 WARNING! DO NOT EDIT THIS FILE OR ANY TEMPLATE FILES IN THIS THEME!

 To make it easy to update your theme, you should not edit this file. Instead, you should create a
 Child Theme first. This will ensure your template changes are not lost when updating the theme.

 You can learn more about creating Child Themes here: http://codex.wordpress.org/Child_Themes

 You have been warned! :)
 ===================================================================================================
 */

get_header();

global $post;
$args=array(
	'post_type' => 'ct_person',
	'post_status' => 'publish',
	'p' => $post->ID,
	'posts_per_page' => 1,
);
$query = null;
$query = new WP_Query($args);

$ppl_role = get_post_meta($post->ID, '_ct_ppl_role', true);

$ppl_emaillabel = get_post_meta($post->ID, '_ct_ppl_emaillabel', true);
$ppl_emailaddress = get_post_meta($post->ID, '_ct_ppl_emailaddress', true);

$ppl_phonelabel1 = get_post_meta($post->ID, '_ct_ppl_phonelabel1', true);
$ppl_phonenum1 = get_post_meta($post->ID, '_ct_ppl_phonenum1', true);
$ppl_phonelabel2 = get_post_meta($post->ID, '_ct_ppl_phonelabel2', true);
$ppl_phonenum2 = get_post_meta($post->ID, '_ct_ppl_phonenum2', true);
$ppl_phonelabel3 = get_post_meta($post->ID, '_ct_ppl_phonelabel3', true);
$ppl_phonenum3 = get_post_meta($post->ID, '_ct_ppl_phonenum3', true);

$ppl_delicious = get_post_meta($post->ID, '_ct_ppl_delicious', true);
$ppl_facebook = get_post_meta($post->ID, '_ct_ppl_facebook', true);
$ppl_flickr = get_post_meta($post->ID, '_ct_ppl_flickr', true);
$ppl_lastfm = get_post_meta($post->ID, '_ct_ppl_lastfm', true);
$ppl_linkedin = get_post_meta($post->ID, '_ct_ppl_linkedin', true);
$ppl_myspace = get_post_meta($post->ID, '_ct_ppl_myspace', true);
$ppl_picasa = get_post_meta($post->ID, '_ct_ppl_picasa', true);
$ppl_ping = get_post_meta($post->ID, '_ct_ppl_ping', true);
$ppl_posterous = get_post_meta($post->ID, '_ct_ppl_posterous', true);
$ppl_tumblr = get_post_meta($post->ID, '_ct_ppl_tumblr', true);
$ppl_twitter = get_post_meta($post->ID, '_ct_ppl_twitter', true);
$ppl_wordpress = get_post_meta($post->ID, '_ct_ppl_wordpress', true);
$ppl_youtube = get_post_meta($post->ID, '_ct_ppl_youtube', true);

$person_settings = get_option('ct_person_settings');
isset($person_settings['single_layout']) ? $page_layout = $person_settings['single_layout'] : $page_layout = null;
isset($person_settings['facebook_likes']) ? $facebook_likes = $person_settings['facebook_likes'] : $facebook_likes = null;
isset($person_settings['tweet_this']) ? $tweet_this = $person_settings['tweet_this'] : $tweet_this = null;

?>
		<div id="ribbon" class="page">
			<div class="container_12 grid-container content">
				<div class="ribbon-wrapper">
					<div class="<?php if(!empty($ppl_role)): ?>grid_7 grid-60<?php else: ?>grid_12 grid-100<?php endif; ?> alpha">
						<h1><?php the_title(); ?></h1>
					</div>
	<?php if(!empty($ppl_role)): ?>
					<div class="grid_5 grid-40 omega">
						<span class="tagline"><?php echo $ppl_role; ?></span>
					</div>
	<?php endif; ?>
				</div>
			</div>
		</div>
		<div id="wrapper3" class="container_12 grid-container">
<?php if($page_layout == 'left'): get_sidebar(); endif; ?>
			<div id="content" class="<?php if($page_layout == 'full'): echo 'grid_12 grid-100'; else: echo 'grid_8 grid-66'; endif; ?> <?php if($page_layout == 'left'): echo 'omega'; else: echo 'alpha'; endif; ?> single single-person">
<?php if($query->have_posts()) while($query->have_posts()): $query->the_post(); ?>
				<?php if(has_post_thumbnail()): ?>
				<div class="image"><?php the_post_thumbnail('single'); ?></div>
				<?php endif; ?>
				<?php the_content(); ?>
				<?php ct_person_contact(); ?>
				<?php ct_person_social(); ?>
<?php if((empty($facebook_likes) || $facebook_likes == 'on') || (empty($tweet_this) || $tweet_this == 'on')): ?>
				<div class="social">
					<ul>
<?php if((empty($facebook_likes) || $facebook_likes == 'on')): ?>
						<li><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php the_permalink(); ?>" layout="button_count" show_faces="false" font="lucida grande"></fb:like></li>
<?php endif; ?>
<?php if((empty($tweet_this) || $tweet_this == 'on')): ?>
						<li><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal"><?php _e('Tweet', 'churchthemes'); ?></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></li>
<?php endif; ?>
					</ul>
				</div>
<?php endif; ?>
				<?php edit_post_link( __('Edit this person', 'churchthemes'), '<div class="edit-post">', '</div>'); ?>
				
				<?php comments_template('', true); ?>
				
<?php endwhile; // end of the loop. ?>
			</div>
<?php if($page_layout == 'right' || empty($page_layout)): get_sidebar(); endif; ?>
		</div>
<?php get_footer(); ?>