But how is it with the artist page?
I was thinking of filtering each project that has the name of the artist, but is there another, more efficient was of doing that?
Hey first of all thank you
I have another more advanced question.
I could just filter each page, but the pages field stores an array, because there can be more then one artist assigned to a project.
So I cant really use the filterBy('artists' $page->title(), ',')
Here is my suggested solution (We are in a artist page):
<?php
$title = $page->title(); #artist 01
$projects = $site->children()->template('projects')->children(); #project 01, project 02, etc.
foreach($projects as $page):
foreach ($page->artist()->toPages() as $related):
$artist_project = $related->title();
if($artist_project == $title): #I thought to compare the current page title with the pages in project, that is probably not cool
#What else can I do? I'm stuck.
#After the if i want to echo the title and url of the correct project, where the artist is assigned to.
echo $page->title();
endif;
endforeach;
endforeach ?>
It’s so simple in theory, but I just cant get over the conversion from the array to the correct name, and then compare each project->artist.