Hi there
I have a list of images in a Case Study page. I need to show one of them on the Home page (‘home’) and another on a Projects page (‘projects’).
In the file blueprint, I created a field with Checkboxes called ‘Template’
fields:
template:
label: Template
type: checkboxes
options:
home: Home
projects: Projects
help: '(this image will show on the Home and/or Projects page if selected)'
In some instances, the one image will need to show on both Home and Projects pages.
The code works when one Template is checked and an image is called. For example:
<?php if($home = $caseStudy->images()->template('home')->sortBy('sort')->first()): ?>
<?= $home ?>
<?php endif ?>
or
<?php if($projects = $caseStudy->images()->template('projects')->sortBy('sort')->first()): ?>
<?= $projects ?>
<?php endif ?>
However, when both are checked (“home, projects”) the image does not show at all.
My question is how can I call an image with both Checkboxes selected?
Much appreciate your help