yan-k
5/30/2016 - 1:28 PM

Enfold: Search Results as Grid

Enfold: Search Results as Grid

/* =============================================================================
   Search Results
   ========================================================================== */

.search.search-results,
.search.search-no-results {
	main.content {
		width: 100%;
		padding: 0;

		.fallback-post-type-icon,
		.slide-entry-excerpt.entry-content,
		.slide-meta-time {
			display: none;
		}
	}
}

.search-results-header {
	padding-top: 30px !important;
	padding-bottom: 30px !important;
}

.template-search .post-entry {
	clear: none;
}
<?php
global $avia_config;


	/*
	 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
	 */
	 get_header();
	 
	 //	allows to customize the layout
	 do_action( 'ava_search_after_get_header' );


	 $results = avia_which_archive();
	 echo avia_title(array('title' => $results ));
	 
	 do_action( 'ava_after_main_title' );
	 ?>

		<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>

			<div class='container'>

				<main class='content template-search <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content'));?>>

                    <?php
						if( !empty($_GET['s']) ) {

							if ( have_posts() ) {
								
								echo '<div style="padding-bottom:10px;font-size:24px;" class="av-special-heading av-special-heading-h1 custom-color-heading blockquote modern-quote  avia-builder-el-1  el_before_av_textblock  avia-builder-el-first   av-inherit-size">';
								echo "<h2 class='av-special-heading-tag search-results-header'>{$results}</h2>";
								echo '<div class="special-heading-border"><div class="special-heading-inner-border" style=""></div></div></div>';

								global $posts;
								$post_ids = array();
								foreach($posts as $post) $post_ids[] = $post->ID;

								$atts = array(
									'type' => 'grid',
									'items' => -1,
									'columns' => 4,
									'class' => 'avia-builder-el-no-sibling',
									'paginate' => 'yes',
									'use_main_query_pagination' => 'yes',
									'image_size' => 'magazine',
									'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types() )
								);

								$blog = new avia_post_slider($atts);
								$blog->query_entries();
								echo "<div class='entry-content'>".$blog->html()."</div>";

							} else {
								echo '<div style="padding-bottom:10px;font-size:24px;" class="av-special-heading av-special-heading-h1 custom-color-heading blockquote modern-quote  avia-builder-el-1  el_before_av_textblock  avia-builder-el-first   av-inherit-size">';
								echo "<h2 class='av-special-heading-tag search-results-header'>".__('No Results Found', 'avia_framework')."</h2>";
								echo '<div class="special-heading-border"><div class="special-heading-inner-border" style=""></div></div></div>';
							}
						}
					?>

				<!--end content-->
				</main>

				<?php

				//get the sidebar
				$avia_config['currently_viewing'] = 'page';

				// get_sidebar();

				?>

			</div><!--end container-->

		</div><!-- close default .container_wrap element -->




<?php get_footer(); ?>