Hello I want to show only the articles with the subject name “nutrition” when the $_POST[‘nutrition’] is set.
I got this
<?php
if(isset($_POST['nutrition'])){
?>
<section class="content cf">
<?php foreach($articles as $article): ?>
<article class="articles">
<h2>
<a href="<?php echo $article->url() ?>"><?php echo $article->title()->html() ?></a>
</h2>
<time datetime="<?php echo $article->date('c') ?>" pubdate="pubdate"><?php echo $article->date('d.m.Y') ?></time> | <?php echo $article->subject() ?>
<?php if($article->hasImages()){?>
<img src="<?php $img = $article->banners();
echo $article->url() . "/" . $img;
?>" style="border-bottom: 5px solid <?php $prev = $article; $color = $prev->color(); echo $color; ?>"><?php } ?>
</article>
<?php endforeach ?>
but this shows all the articles but I want to show only the ones with the subject nutrition.
Does anyone have an idea how I can do so.