<?php
/**
 * The loop that displays posts.
 *
 * The loop displays the posts and the post content.  See
 * http://codex.wordpress.org/The_Loop to understand it and
 * http://codex.wordpress.org/Template_Tags to understand
 * the tags used in it.
 *
 * This can be overridden in child themes with loop.php or
 * loop-template.php, where 'template' is the loop context
 * requested by a template. For example, loop-index.php would
 * be used if it exists and we ask for the loop with:
 * <code>get_template_part( 'loop', 'index' );</code>
 *
 * @package WordPress
 * @subpackage ThinkPlace
 * @since ThinkPlace 1.0
 */

// Get list of people-to-authors
$people = thinkplace::getPeopleAuthors();
// Category nav to parent "page" structure
// Probably inadvisable, but there's no clear association between the two
$category_page_association = array(
  'papers-and-presentations'  => 'papers-and-presentations',
  'helpful-frameworks' => 'helpful-frameworks',
  'thinkpieces'        => 'thinkpieces'
);

?>


<?php while ( have_posts() ) : the_post();?>	
			<?php
                $breadcrumb = '<span class="active">'.get_the_title().'</span>';
				 	foreach((get_the_category()) as $category);{
				 	          // Use the $category_page_association to determine correct links
				 	          $category_link = ( isset($category_page_association[$category->slug]) ) ? $category_page_association[$category->slug] : $category->slug;
                    $breadcrumb	= '<a href="'.get_bloginfo('url').'/ideas/'.htmlentities( $category_link ).'/">'. $category->cat_name .'</a> &gt; '.$breadcrumb;
                }
                $breadcrumb	= '<a href="'.home_url( '/' ).'">Home</a> &gt; '.$breadcrumb;
                echo '<div class="breadcrumbs">'.$breadcrumb.'</div>';
            ?>

		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
			<h2><?php the_title(); ?></h2>

			<p class="date">
				<span><?php the_date(); ?></span> - By
				<?php echo '<a href="'.get_bloginfo('url').'/about/the-team/?person_id='.$people[get_the_author_meta('ID')].'">';?><?php the_author(); ?></a></p>
			<div>
				<p><?php the_content(); ?></p>
			</div><!-- .entry-content -->
		</div><!-- #post-## -->
<?php break; endwhile; // End the loop. Whew. ?>

