HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/KLeeuwen/samenbouwen.in/wwwroot/wp-content/themes/samenbouwenin/search_results.php
<?php 
/*
 * Template Name: Zoekresultaten
 * Description: Zoekresultaten
 */

get_header(); ?>
<style type="text/css">
	.bluebox{ background-color: #2E222C; padding: 0px;}
	.bluebox * { color: #eeeeee; }
	.bluebox .wbtn { text-align: center; background-color: #219ED4; padding-left: 0px;}
	.bluebox .wbtn a{ color: #eeeeee; font-size: 18px;}
</style>

<div class="aftermenubar"></div>
<div style="min-height:500px">
<h1>Zoekresultaten</h1>
<div class="blueline"></div> 
<br/>
<?php 
	$arResults = array(
		'team' => array(),
		'projecten' => array(),
		'blogs' => array(),
		'page' => array()
	);
	$totalResults = 0;
	if(isset($_GET['term'])) {		
		$query = new WP_Query('s='.$_GET['term']);
		$totalResults = $query->found_posts;		
			
		while ( $query->have_posts() ) : $query->the_post();
			$arResults[$query->post->post_type][] = $query->post->ID;
		endwhile;
	}
	//echo '<pre>';var_dump($arResults); echo '</pre>';exit;
	if(count($arResults['projecten'])) {
		echo '<h2>Projecten in</h2><br/>';
		echo '<div class="row-fluid">';
		foreach($arResults['projecten'] as $i => $postId) {	
			
			$post = get_post($postId);
		 	$locatie = get_field('plaats', $postId);
			$image = get_field('hoofdafbeelding', $postId);
			
			/*if($i % 3 == 0) {
				if($i == 3) echo '</div><br>';?>	
				<div class="row-fluid">
	<?php 	}*/  ?>
			
			<div class="span4 bluebox <?php //if($i == 2 || $i == 5) echo 'mgr0'?>">
				<a href="<?php the_permalink()?>">
					<img src="<?php echo $image['sizes']['project-medium']?>" alt="" width="100%"/><br>
					<div style="margin: 20px">
		                <div class="title"><h3><?php echo strtoupper($locatie);?></h3></div>
		                <br>
		                <table width="100%">
		                    <tr><td>locatie:</td><td class="w"><i><?php echo $locatie?></i></td></tr>
		                    <tr><td>aantal woningen:</td><td class="w"><i><?php echo get_field('aantal_woningen', $postId)?></i></td></tr>
		                    <tr><td>prijsklasse:</td><td class="w"><i>vanaf &euro;<?php echo str_replace(',','.',number_format(get_field('vanaf_prijs', $postId)))?>,- VON</i></td></tr>
		                </table>
		                <br/>
		                <div class="wbtn"><a href="<?php the_permalink()?>">MEER INFORMATIE</a></div>
		             </div>
	            </a>
            </div>  
                     	
<?php 	 } ?>  
 		</div> 		
<?php 
	} 
	if(count($arResults['blogs'])) {	
		echo '<h2>In het nieuws</h2><br><div class="row-fluid">';
		foreach($arResults['blogs'] as $i => $postId){
			$post = get_post($postId);
			$image = get_field('afbeelding', $postId);
	?>
				<div class="span4 blogitem" style="cursor:pointer" onclick="window.location='<?php echo get_permalink($postId)?>'">
	                <div><img src="<?php echo $image['sizes']['medium']?>" alt="<?php echo $image['alt']?>" width="<?php echo $image['sizes']['medium-width']?>"/></div>
	                <div class="blogcont" style="width:<?php echo $image['sizes']['medium-width']?>px">
	                	<h2 class="blogtitle" >&nbsp;&nbsp;<?php echo get_the_title($postId)?></h2>
	                	<div class="blogsmallcont" style="padding: 0px 10px;">
	                		<em><?php echo substr(strip_tags(get_the_content(), 0, 150)).'...'?></em><br/><br/>
	                		<div class="fleft">Door: <?php the_author()?></div>
	                		<div class="fright"><?php the_date('d/m/Y')?></div>
	                		<div class="clear"></div>
	                	</div>		           
			        </div>
	           </div>           
	<?php }  ?>
	</div>	
<?php } 
	if(count($arResults['team'])) {	
		echo '<h2>In het team</h2><br><div class="row-fluid">';
		foreach($arResults['team'] as $i => $postId) {
			$post = get_post($postId);
			$image = get_field('afbeelding', $postId); ?>
			<div class="span2" onclick="window.location='<?php the_permalink()?>'" style="cursor:pointer; padding-bottom:30px;margin-right: 2.5641%;">
                <img src="<?php echo $image['url']?>" style="border: 1px solid #223a54;max-height: 210px; width: auto;">
              	<div class="teaminfo"><div class="greyboxt"><b><?php the_title()?></b></div></div>
            </div>
<?php 	} ?>
	</div>
<?php }	
	if(count($arResults['page'])) {	
		echo '<h2>In ons pakket</h2><br><div>';
		foreach($arResults['page'] as $i => $postId){
			$post = get_post($postId);?>
			<a href="<?php the_permalink() ?>"><?php the_title() ?></a><br><?php 
		}
		echo '</div>';
	}?>

<?php if(!$totalResults) echo '<div>Er werden geen resultaten gevonden</div>';?>
</div>
<?php 

get_footer();
?>