I have a little problem and need a hint to solve my problem.
I want to get the selected parent header-image to be the default selection in the children pages. If there is no other image selected on the children site kirby get the selection from the parent site.
Well, first of all, I guess you donβt really want your page title within the foreach loop or do you?
Other than that - supposing the above code is for the child page, you want to wrap an if - else statement around the above, that checks of $page->hero() is empty or not and if it is, then use the images from the parent page, sth. like.
<?php
if($page->hero()->isNotEmpty()) {
// put your code from above here
} else {
$images = $page->parent()->hero()->split(); //or whatever field you want to grab here
foreach($images as $image) {
// here goes your code
}
}
?>