File: D:/HostingSpaces/KLeeuwen/samenbouwen.in/wwwroot/wp-content/themes/Avada/include/projects.php
<?php
require_once ('../../../../wp-load.php');
$paged = isset($_GET['page']) ? $_GET['page'] : 1;
$args = array(
'post_type' => array('projecten'),
'post_status' => 'publish',
'posts_per_page' => 6,
'paged' => $paged,
'meta_query' => array()
);
$category = 'alles';
if(isset($_GET['category']) && $_GET['category'] != 'alles') {
$args['meta_query'][] = array(
'key' => 'category',
'value' => $_GET['category']
);
$category = $_GET['category'];
}
if(isset($_GET['provincie']) && $_GET['provincie'] != '') {
$args['meta_query'][] = array(
'key' => 'provincie',
'value' => $_GET['provincie']
);
}
if(isset($_GET['sort'])) {
$args['meta_query'][] = array(
'key' => 'soort_woning',
'value' => $_GET['sort']
);
}
$query = new WP_Query($args);
if(!$query->found_posts)
echo '<div class="container" style="color: #eeeeee">Geen project gevonden</div>';
$maxPages = $query->max_num_pages;
$i = 0;
?>
<style type="text/css">
.bluebox{ background-color: #2E222C; padding: 0px;}
.bluebox * { color: #eeeeee; }
.bluebox .wbtn { text-align: center; background-color: #ef6530; padding-left: 0px;}
.bluebox .wbtn a{ color: #eeeeee; font-size: 18px;}
<?php if(isset($_GET['newdsg'])) {?>
.prevprojs {position: absolute; top: 50%; left: 15px;}
.nextprojs {position: absolute; top: 50%; right: 15px;}
<?php }?>
</style>
<div style="<?php if(!isset($_GET['newdsg'])) {?>min-height:862px; <?php }?>position:relative;">
<div class="container">
<?php
while ( $query->have_posts() ) : $query->the_post();
$locatie = get_field('plaats');
$image = get_field('hoofdafbeelding');
$categories = get_field_object('category');
$category = get_field('category');
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 the_field('aantal_woningen')?></i></td></tr>
<?php if( get_field('vanaf_prijs') ): ?>
<tr><td>prijsklasse: </td><td class="w"><i>vanaf €<?php echo str_replace(',','.',number_format(get_field('vanaf_prijs')))?>,- VON</i></td></tr>
<?php endif; ?>
<tr><td>status: </td><td class="w"><i><?php echo $categories['choices'][$category]?></i></td></tr>
<tr><td>doelgroep: </td><td class="w"><i><?php the_field('doelgroep')?></i></td></tr>
</table>
<br/>
<div class="wbtn"><a href="<?php the_permalink()?>"> MEER INFORMATIE</a></div>
</div>
</a>
</div>
<?php
$i++;
endwhile; ?>
</div>
</div>
<?php if(isset($_GET['newdsg'])) {?>
<a href="#" class="prevprojs jcarousel-control-prev <?php if($paged > 1) echo 'active';?>"></a>
<a href="#" class="nextprojs jcarousel-control-next <?php if($paged < $maxPages) echo 'active'; ?>"></a>
<?php }?>
</div>
<br><br>
<div class="container" id="xd">
<div class="row-fluid">
<div class="span4 homeblock first"><a href="/als-collectief-in-uw-eigen-gemeente-aan-de-slag"><h4>ALS COLLECTIEF IN<br/>UW EIGEN GEMEENTE<br/>AAN DE SLAG</h4></a></div>
<div class="span4 homeblock first"><a href="/wat-als-ik-grond-heb-voor-een-collectief"><h4>WAT ALS IK GROND<br/>HEB VOOR EEN<br/>COLLECTIEF ?</h4></a></div>
<div class="span4">
<?php if(!isset($_GET['newdsg'])) {?>
<div class="pull-right">
<ul class="inlineul">
<li><a href="#" class="prevprojs"><i class="f-darkone-left <?php if($paged > 1) echo 'active';?>"></i></a></li>
<li><a href="#" class="nextprojs"><i class="f-darkone-right <?php if($paged < $maxPages) echo 'active'; ?>"></i></a></li>
</ul>
</div>
<?php } ?>
<div class="clearfix"></div>
</div>
</div><br><br>
<a href="/projecten-in/"><div class="obtn" id="knopje">BEKIJK ALLE PROJECTEN</div></a>
</div>
<script type="text/javascript">
$('.prevprojs').click(function(e){
e.preventDefault();
<?php if($paged > 1) {?>
$("#projectsArea").fadeOut("slow");
$.ajax({
type: 'post',
url: '<?php echo get_template_directory_uri(); ?>/include/projects.php?page=<?php echo $page - 1?>&category=<?php echo $category?><?php if(isset($_GET['newdsg'])) echo '&newdsg=1';?>',
success : function(data) {
$('#projectsArea').html(data);
$("#projectsArea").fadeIn();
$('#projectsArea .bluebox').hide();
$('#projectsArea .bluebox').each(function(i) {
$(this).delay(200*i).fadeIn();
});
}
});
<?php }?>
});
$('.nextprojs').click(function(e){
e.preventDefault();
<?php if($paged < $maxPages) {?>
$("#projectsArea").fadeOut("slow");
$.ajax({
type: 'post',
url: '<?php echo get_template_directory_uri(); ?>/include/projects.php?page=<?php echo $page + 1?>&category=<?php echo $category?><?php if(isset($_GET['newdsg'])) echo '&newdsg=1';?>',
success : function(data) {
$('#projectsArea').html(data);
$("#projectsArea").fadeIn();
$('#projectsArea .bluebox').hide();
$('#projectsArea .bluebox').each(function(i) {
$(this).delay(200*i).fadeIn();
});
}
});
<?php }?>
});
</script>