The presentation of projects is defined in the template. The project category “Coming Soon” should now not be displayed in the upper area. The code was added to lines 31 to 37:
'meta_query' => array(
array(
'key' => 'project_kategorie',
'value' => 'Coming Soon',
'compare' => 'NOT LIKE'
)
)
However, the “Coming Soon” category should be displayed again at the bottom (from line 140).
Here is the complete template:
<div class="mobile_spacer"></div>
<section class="row content_row">
<div class="col col_12 col_10_sm col_shift_1_sm col_6_m col_shift_1-5_m">
<div class="text big">
<h1 class="hl"><?php the_field("page_hl"); ?></h1>
<?php the_field("page_text"); ?>
</div>
<div class="link_ct">
<br>
<a href="#projektuebersicht" class="link">Zur Projektübersicht nach Kategorien</a>
</div>
</div>
</section>
<?php
$args = array(
'numberposts' => -1,
'post_type' => 'project',
'suppress_filters' => false,
'meta_query' => array(
array(
'key' => 'project_kategorie',
'value' => 'Coming Soon',
'compare' => 'NOT LIKE'
)
)
);
$projects = get_posts( $args);
?>
<?php
$project_array = [];
$project_i = 1;
$project_i_all = 1;
$project_wrapper = "";
$project_max_i = count($projects);
foreach ($projects as $project) {
$project_img = get_the_post_thumbnail_url($project, "large");
$project_ct = '
<a href="'.get_the_permalink($project).'" class="project_ct">
<div class="project_img">
<div class="project_img_overlay"></div>
<img src="'.$project_img.'" alt="">
</div>
<h2 class="project_hl">'.get_the_title($project).'</h2>
<h3 class="project_sl">'.get_field('project_subline', $project).'</h3>
</a>
';
$project_wrapper_mobile .= '<div class="col col_12 col_10_sm col_shift_1_sm">'.$project_ct.'</div>';
$project_datum = get_field('project_datum', $project);
if(get_field('project_datum', $project)){
$project_datum = ", ".$project_datum;
}
$project_array[get_field('project_kategorie', $project)] .= '<li><a href="'.get_the_permalink($project).'">'.get_the_title($project).$project_datum.'</a></li>';
if($project_i == 1){
$project_wrapper .= '<section class="row project_row three_projects">';
}
else if($project_i == 4){
$project_wrapper .= '<section class="row project_row two_projects">';
}
switch ($project_i) {
case 1:
case 2:
case 3:
$project_wrapper .= '<div class="col col_12 col_10_sm col_shift_1_sm col_3_m col_shift_1-5_m">'.$project_ct.'</div>';
break;
case 4:
case 5:
$project_wrapper .= '<div class="col col_12 col_10_sm col_shift_1_sm col_5_m col_shift_1_m">'.$project_ct.'</div>';
break;
}
if($project_i == 3){
$project_wrapper .= '</section>';
}
else if($project_i == 5){
$project_wrapper .= '</section>';
$project_i = 0;
}
if($project_max_i == $project_i_all && ($project_i != 3 && $project_i !== 5)){
$project_wrapper .= '</section>';
}
$project_i++;
$project_i_all++;
?>
<?php
}
?>
<div class="projects_wrapper_desktop hide show_m">
<?php echo $project_wrapper; ?>
</div>
<div class="projects_wrapper_mobile hide_m">
<section class="row content_row">
<?php echo $project_wrapper_mobile; ?>
</section>
</div>
<section class="row projektuebersicht_row" id="projektuebersicht">
<div class="col col_12 col_10_sm col_shift_1_sm col_9_m col_shift_1-5_m">
<div class="text big">
<h2 class="hl">Projektübersicht</h2>
</div>
<div class="projects_kategorie_ct">
<?php foreach ($project_array as $key => $value){ ?>
<div class="projects_kategorie">
<h3><?php echo $key; ?></h3>
<ul>
<?php echo $value; ?>
</ul>
</div>
<?php } ?>
</div>
</div>
</section>
Thank you for support. I’m still too new here…
New contributor
user24849097 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1