<?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_location',
	'post_status' => 'publish',
	'p' => $post->ID,
	'posts_per_page' => 1,
);
$query = null;
$query = new WP_Query($args);

$loc_map_code = get_post_meta($post->ID, '_ct_loc_map_code', true);

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

?>
		<div id="ribbon" class="page">
			<div class="container_12 grid-container content">
				<div class="ribbon-wrapper">
					<div class="grid_6 grid-50 alpha">
						<h1><?php the_title(); ?></h1>
					</div>
					<div class="grid_6 grid-50 omega">
						<span class="tagline"><?php ct_location_tagline(); ?></span>
					</div>
				</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-location">
<?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 ct_location_services(); ?>
				<?php the_content(); ?>
<?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 if ( $loc_map_code ) : ?>
				<div class="map"><?php echo $loc_map_code // xss ok ?></div>
				<?php endif; ?>
				<?php edit_post_link(__('Edit this location', '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(); ?>