  <?php get_template_part('header');?>
  <body <?php body_class();?>>
 	<?php get_template_part('topbar');?>
    <?php get_template_part('logoarea');?>
   <div class="wrapper" id="blog">
    	<div class="container">
        	<div class="content-heading">
    			<h2><i class="fa fa-search"></i> <?php _e( 'Search Results: ', 'activehost' ); ?> <?php the_title(); ?></h2>
                <div class="search-wiki">
                <form role="search" method="get" id="searchform" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
                <div>
                    <input type="text" value="<?php echo esc_attr(get_search_query()); ?>" name="s" id="s" />
                    <input type="submit" value="<?php echo esc_attr_x( 'Search', 'activehost' ); ?>" />
                </div>
            </form>
            </div>
            </div>
        </div>
    </div>
    <div class="wrapper" id="maincontent">
    	<div class="container">
   <?php 
	if ( have_posts() ) {?>
            <div class="relative">
		<div class="row isotopefilter searchresults" data-id="archivecontent">
		<?php while ( have_posts() ) {the_post();  ?>
        			<?php 
					$category = get_the_category();
					?>
					<div class="col-sm-3 col-xs-6<?php foreach($category as $cat){ echo esc_html(" ".$cat->slug); $catarray[$cat->slug] = $cat->name; }?>">
                    <?php if(get_post_type()=="post"){;?>
                	<div <?php post_class("post"); ?>>
                		<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
                        <h3><?php the_title();?></h3>
                        <small><?php _e( 'Author: ', 'activehost');?><?php the_author();?></small> 
                        <small><?php _e( 'Category: ', 'activehost');?><?php
						$i = 0;
						$categories = get_the_category();
						foreach($categories as $cat){$i++;
							if($i!=1){
								echo esc_html(", ".$cat->cat_name);
							}else{
								echo esc_html($cat->cat_name);
							}
						}
						?></small>
    
                        <div class="post-image"><?php the_post_thumbnail(); ?><span><i class="glyphicon glyphicon-calendar"></i><?php the_time('jS M'); ?></span></div>
                         <?php the_excerpt(); ?>
                     </div>
                     <?php }?>
                     <?php if(get_post_type()=="plan"){;?>
                	<div <?php post_class("post"); ?> <?php echo esc_html('style="background-color:'.get_field("color").'"'); ?>>
                		<a href="<?php the_field("order_link"); ?>"><?php the_title();?></a>
                        <h3><img src="<?php echo esc_url(get_template_directory_uri());?>/images/icons/server.png"/> <?php the_title();?></h3>
                        <small><?php the_field("tagline"); ?></small>
                     </div>
                     <?php }?>
                      <?php if(get_post_type()=="page"){;?>
                	<div <?php post_class("post"); ?>>
                		<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
                        <h3><i class="fa fa-file"></i> <?php the_title();?></h3>
                     </div>
                     <?php }?>
                </div>
		<?php } // end while ?>
		</div>
        <?php paginate_links();?>
        <?php if(isset($thiscat) && get_field("filter_by", $thiscat) && get_field("filter_by", $thiscat) != "none"){?>
        <div class="suboptions" data-holder="archivecontent">
						<div class="btn-group">
						  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
							<?php _e( 'View All', 'activehost');?> <span class="caret"></span>
						  </button>
						  <ul class="dropdown-menu" role="menu">
							<li><a href="#all" data-filter="*"><?php _e( 'View All', 'activehost');?></a></li>
                            <?php $catarray = array_unique($catarray); 
                            foreach($catarray as $catslug => $catname){?>
                            <li><a href="#<?php echo esc_html($catslug); ?>" data-filter=".<?php echo esc_html($catslug); ?>"><?php echo esc_html($catname); ?></a></li>
                            <?php }?>
                          </ul>
                          </div>
                          </div>
     <?php }?>			
   </div>
	<?php }else {echo '<h2>'; _e( 'No results returned.', 'activehost' ); echo '</h2>'; } ?>
    
    	</div>
    </div>
 <?php get_template_part('footer');?>