<?php
/**
 * @package The Columnist
 * @since The Columnist 1.0
 */
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>


	<?php if ( is_search() || is_home() || is_archive() ) : // Only display Excerpts for Search ?>
		<a class="feed-item" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'the_columnist' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark">
			<header class="entry-header">
				<?php
					$images = get_children( array(
						'post_parent'    => $post->ID,
						'post_type'      => 'attachment',
						'post_mime_type' => 'image',
						'orderby'        => 'menu_order',
						'order'          => 'ASC',
						'numberposts'    => 1
					) );

					if ( '' != get_the_post_thumbnail() ) : ?>
					<div class="thumbnail">
						<?php the_post_thumbnail( 'list-thumb' ); ?>
						<h1 class="entry-title"><?php the_title(); ?></h1>
					</div>
				<?php elseif ( $images ) : ?>
					<div class="thumbnail">
						<?php $image = array_shift( $images );
							echo wp_get_attachment_image( $image->ID, 'list-thumb' ); ?>
						<h1 class="entry-title"><?php the_title(); ?></h1>
					</div>
				<?php else : ?>
					<div class="placeholder">
						<h1 class="entry-title"><?php the_title(); ?></h1>
					</div>
				<?php endif; ?>
			</header><!-- .entry-header -->

			<div class="entry-summary">
				<?php the_excerpt(); ?>
				<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'the_columnist' ), 'after' => '</div>' ) ); ?>
			</div><!-- .entry-summary -->
		</a>
	<?php else : ?>
		<div class="entry-content">
			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'the_columnist' ) ); ?>
			<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'the_columnist' ), 'after' => '</div>' ) ); ?>
		</div><!-- .entry-content -->

		<footer class="entry-meta">
			<?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
				<?php
					/* translators: used between list items, there is a space after the comma */
					$categories_list = get_the_category_list( __( ', ', 'the_columnist' ) );
					if ( $categories_list && the_columnist_categorized_blog() ) :
				?>
				<span class="cat-links">
					<?php printf( __( 'Posted in %1$s', 'the_columnist' ), $categories_list ); ?>
				</span>
				<?php endif; // End if categories ?>

				<?php the_tags(
					/* translators: used before a list of the post's tags */
					'<span class="tag-links">' . __( 'Tagged', 'the_columnist' ) . ' ',
					/* translators: used between list items, there is a space after the comma */
					__( ', ', 'the_columnist' ),
					'</span><span class="sep"> | </span>'
				); ?>
			<?php endif; // End if 'post' == get_post_type() ?>

			<?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
			<span class="sep"> | </span>
			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'the_columnist' ), __( '1 Comment', 'the_columnist' ), __( '% Comments', 'the_columnist' ) ); ?></span>
			<?php endif; ?>

			<?php edit_post_link( __( 'Edit', 'the_columnist' ), '<span class="sep"> | </span><span class="edit-link">', '</span>' ); ?>
		</footer><!-- #entry-meta -->
	<?php endif; ?>


</article><!-- #post-<?php the_ID(); ?> -->