<?php
/**
 * Theme: luxuryconceptfree
 *
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * Also it's used to display search results, category page, tag page and date page.
 *
 * @package luxuryconceptfree
 */
 get_header(); ?>
	
	<div class="primary-sidebar"><?php get_sidebar( 'primary' ); ?></div>	

	<main id="content" class="main-content">	
			
        <?php  /* CONDITIONAL TEMPLATES */ ?>
		<?php if ( is_search() ) { ?>
			<h1 class="mb-3"><?php esc_html_e('Result for:', 'luxuryconceptfree'); ?> <strong><i><?php echo esc_html($s); ?></i></strong></h1>
		<?php } elseif ( is_category() || is_tag() ) { ?>
			<h1 class="mb-3"><?php echo single_cat_title(); ?></h1>
		<?php } elseif ( is_front_page() ){ ?>
			<h1 class="mb-3"><?php esc_html_e('Latest posts ', 'luxuryconceptfree') ?></h1>
		<?php } elseif ( is_home() ){ ?>
			<h1 class="mb-3"><?php echo single_post_title(); ?></span></h1>
		<?php } elseif ( is_date() ){ ?>
			<h1 class="mb-3"><?php single_month_title(' '); ?> </h1>
		<?php } elseif ( is_author() ){ ?>
		    <h1 class="mb-3"><?php esc_html_e('Author: ', 'luxuryconceptfree') . the_author_meta('display_name'); ?> </h1>
		<?php } elseif ( is_archive() ){ ?>
			<h1 class="mb-3"><?php post_type_archive_title(); ?> </h1>
		<?php } ?>

		<div class="grid-masonry">

		<?php if (have_posts()) :?><?php while(have_posts()) : the_post(); ?>

			<div class="grid-masonry-item">

			<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
					<?php if(esc_attr(get_theme_mod( 'luxuryconceptfree_article_img', 'no')) == 'before') { ?> 
						<a href="<?php the_permalink(); ?>" class="">
							<?php the_post_thumbnail('luxuryconceptfree_single', array('class' => 'img-res img-before-title mb-2','alt' => get_the_title())); ?>
						</a>
					<?php } ?>
					<div class="post-content-text">
						<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
						<p class="post-meta"><?php echo esc_html(the_time( get_option( 'date_format' ) ) ); ?> - <?php the_category(', '); ?> - <?php esc_html_e('By', 'luxuryconceptfree'); ?> <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );  ?>"><?php the_author_meta('display_name'); ?></a> - 

						<a href="<?php echo esc_url(get_comments_link()); ?>" title="<?php the_title_attribute(array('before' => esc_attr__( 'Comments On ', 'luxuryconceptfree'))); ?>"><?php comments_number( esc_html__( 'No Responses', 'luxuryconceptfree' ), esc_html__( '1 Response', 'luxuryconceptfree' ), esc_html__( '% Responses', 'luxuryconceptfree') ); ?></a>
						</p>

						<?php if(esc_attr(get_theme_mod( 'luxuryconceptfree_article_img', 'no')) == 'after') { ?> 
							<a href="<?php the_permalink(); ?>" class="">
								<?php the_post_thumbnail('luxuryconceptfree_single', array('class' => 'img-res img-after-title mb-2','alt' => get_the_title())); ?>
							</a>
						<?php } ?>

						<?php the_excerpt();?>


						<?php $post_tags = wp_get_post_tags($post->ID); if(!empty($post_tags)) { ?>
							<p><span class="post-tags"> <?php the_tags('', ', ', ''); ?> </span></p>
						<?php } ?>
					</div>
			</article>
		</div>

		<?php endwhile; ?>
		</div>	
                    <?php /* Include Pagination Template */
					get_template_part( 'inc/content/pagination' );  ?>

		<?php else : ?>

				<h3><?php esc_html_e('Sorry, no posts matched your criteria.', 'luxuryconceptfree'); ?></h3>
				<?php get_search_form(); ?>
		
        <?php endif; ?>
	</main>


<?php get_footer(); ?>