<?php get_header(); ?>

<?php gp_page_header( get_the_ID() ); ?>

<div id="content-wrapper" class="gp-container">

	<div id="content">

		<div id="new-search">
			
			<?php if ( isset( $_GET['s'] ) && ( $_GET['s'] != '' ) ) { ?>
				
				<div class="post-section-header">
					<h3><?php _e( 'New Search', 'gp_lang' ); ?></h3>
					<div class="post-section-header-line"></div>
				</div>
				
				<p><?php _e( 'If you didn\'t find what you were looking for try searching again.', 'gp_lang' ); ?></p>
				
			<?php } else { ?>
			
				<div class="post-section-header">
					<h3><?php _e( 'Empty Search', 'gp_lang' ); ?></h3>
					<div class="post-section-header-line"></div>
				</div>
				
				<p><?php _e( 'You left the search box empty, please enter a valid term.', 'gp_lang' ); ?></p>
			
			<?php } ?>	
			
			<?php get_search_form(); ?>
			
		</div>

		<?php if ( isset( $_GET['s'] ) && ( $_GET['s'] != '' ) ) { ?>
		
			<div class="blog-wrapper <?php echo sanitize_html_class( $GLOBALS['gp_format'] ); ?> <?php echo sanitize_html_class( $GLOBALS['gp_size'] ); ?>"<?php echo gp_data_properties( 'taxonomy' ); ?>>

				<?php if ( $GLOBALS['gp_filter'] == 'enabled' ) { get_template_part( 'lib/sections/filter' ); } ?>
			
				<?php if ( have_posts() ) : ?>
							
					<div class="inner-loop <?php echo sanitize_html_class( $gp['ajax'] ); ?>">

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

							<?php if ( get_post_meta( get_the_ID(), '_wp_page_template', true ) == 'review-template.php' OR get_post_meta( get_the_ID(), '_wp_page_template', true ) == 'hub-template.php' OR $post->post_type == 'gp_user_review' ) { 
								get_template_part( 'review', 'loop' ); 
							} else {
								get_template_part( 'post', 'loop' ); 
							} ?>

						<?php endwhile; ?>
			
					</div>

					<?php echo gp_pagination( $wp_query->max_num_pages ); ?>

				<?php else : ?>

					<strong class="no-items-found"><?php _e( 'No items found.', 'gp_lang' ); ?></strong>

				<?php endif; ?>
			
			</div><!-- END BLOG WRAPPER -->
		
		<?php } ?>			
		
	</div><!-- END CONTENT -->

	<?php get_sidebar(); ?>

</div><!-- END CONTENT WRAPPER -->

<?php get_footer(); ?>