Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #506501

    Hi Guys,

    I have a couple of queries:

    1. Creating a grid style results page from a search
    2. Add a sidebar to the page but needs to override the Enfold ->Options Pages have no sidebar ? im assuming Search.php is a post type “Page”

    The following code I have put together from bits and pieces I have found in the forum however the get_post_types() function seems to return alot of unwanted results as I have over 40 plugins running so it is picking up for example Paypal IPN post types ? could we perhaps pass an array to ‘post_types’=> array(‘product’, ‘post’) ? and just have it search posts and products ?

    global $avia_config;
    	 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    	 //$avia_config['layout']['current'] = $avia_config['layout']['sidebar_left'];
    	 //	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'));?>>
                        <div class='page-heading-container clearfix'>
                            <section class="search_form_field">
                                echo "<h4>".__('New Search','avia_framework')."</h4>";
                                echo "<p>".__('If you are not happy with the results below please do another search','avia_framework')."</p>";
                                echo "<span class='author-extra-border'></span>";
    						echo "<h4 class='extra-mini-title widgettitle'>{$results}</h4>";
    						global $posts;
    						$post_ids = array();
    						foreach($posts as $post) $post_ids[] = $post->ID;
    						$atts   = array(
    						'type' => 'grid',
    						'items' => 60/*get_option('posts_per_page')*/,
    						'columns' => 4,
    						'class' => 'avia-builder-el-no-sibling',
    						'paginate' => 'yes',
    						'use_main_query_pagination' => 'yes',
    						'custom_query' => array( 'post__in'=>$post_ids,'post_types'=>array('product', 'post'))
    						$blog = new avia_post_slider($atts);
    						echo "<div class='entry-content'>".$blog->html()."</div>";
    				<!--end content-->
    				//get the sidebar
    				$avia_config['currently_viewing'] = 'shop';
    							//$avia_config['currently_viewing'] = 'shop';
    //echo '<aside class="sidebar sidebar_left alpha units"><div class="inner_sidebar extralight-border">';
    //dynamic_sidebar( 'Shop Overview Page' );
     // $default_sidebar = false;
    //echo '</div></aside>';
    			</div><!--end container-->
    		</div><!-- close default .container_wrap element -->
    <?php get_footer(); ?>

    Hey Bass!

    You can loop through the results like so.

    $post_types = get_post_types();
    foreach ( $post_types  as $post_type ) {
      if ( $post_type->name == "product" ) {  }

    Best regards,


    Hi Elliott,

    Thanks for that however how would that be implemented in my code above ? also is it possible to add a sidebar to this search page even though in Enfold options I have selected no sidebar to post type ‘Pages’ ? Thank you any assistance is always appreciated thanks mate




    I don’t see where your using the get_post_types() in your code.

    So this is not working for you?

    'custom_query' => array( 'post__in'=>$post_ids,'post_types'=>array('product', 'post'))

    Best regards,

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Grid style search results with sidebar’ is closed to new replies.