Im Template ist die Darstellung von Projekten definiert. Es sollen nun im oberen Bereich die Projekt-Kategorie “Coming Soon” nicht angezeigt werden. Dazu wurde in Zeile 31 bis 37 der Code ergänzt:
'meta_query' => array(
array(
'key' => 'project_kategorie',
'value' => 'Coming Soon',
'compare' => 'NOT LIKE'
)
)
Allerdings soll an unterer Stelle (ab Zeile 140) die Kategorie “Coming Soon” wieder angezeigt werden.
Hier das komplette 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>
Vielen Dank für Unterstützung. Bin noch zu neu hier …
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.