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

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<header class="entry-header">
		<?php
		$image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumbnail' );
		if ( '' != get_the_post_thumbnail( $post->ID ) && $image[1] >= 610 ) :
			the_post_thumbnail( 'banner-image', array( 'class' => 'banner-img' ) );
		endif;
		?>
		<a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">Home</a>
	</header><!-- .entry-header -->

	<div class="entry-content">
		<?php the_content(); ?>
		<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'the_columnist' ), 'after' => '</div>' ) ); ?>
	</div><!-- .entry-content -->

	<footer class="entry-meta">
		<?php
			/* translators: used between list items, there is a space after the comma */
			$category_list = get_the_category_list( __( ', ', 'the_columnist' ) );

			/* translators: used between list items, there is a space after the comma */
			$tag_list = get_the_tag_list( '', ', ' );

			if ( ! the_columnist_categorized_blog() ) {
				// This blog only has 1 category so we just need to worry about tags in the meta text
				if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) {
					$meta_text = __( '<span class="meta-tax"><strong>Tagged:</strong> %2$s</span><a class="permalink" href="%3$s" title="Permalink to %4$s" rel="bookmark">Permalink</a>', 'the_columnist' );
				} else {
					$meta_text = __( '<a class="permalink" href="%3$s" title="Permalink to %4$s" rel="bookmark">Permalink</a>', 'the_columnist' );
				}

			} else {
				// But this blog has loads of categories so we should probably display them here
				if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) {
					$meta_text = __( '<span class="meta-tax"><strong>Posted in:</strong> %1$s</span><span class="meta-tax"><strong>Tagged:</strong> %2$s</span><a class="permalink" href="%3$s" title="Permalink to %4$s" rel="bookmark">Permalink</a>', 'the_columnist' );
				} else {
					$meta_text = __( '<span class="meta-tax"><strong>Posted in:</strong> %1$s</span><a class="permalink" href="%3$s" title="Permalink to %4$s" rel="bookmark">Permalink</a>', 'the_columnist' );
				}

			} // end check for categories on this blog

			// If $tag_list contains a WP Error, empty it before printf(), just in case
			if ( is_wp_error( $tag_list ) ) {
				$tag_list = '';
			}

			printf(
				$meta_text,
				$category_list,
				$tag_list,
				get_permalink(),
				the_title_attribute( 'echo=0' )
			);

			comments_popup_link( __( 'Leave a comment', 'the_columnist' ), __( '1 Comment', 'the_columnist' ), __( '% Comments', 'the_columnist' ) );
			edit_post_link( __( 'Edit', 'the_columnist' ), '<span class="edit-link">', '</span>' );
		?>
	</footer><!-- .entry-meta -->
</article><!-- #post-<?php the_ID(); ?> -->