Get the field of the parent pages if it's empty or not exists. It goes all up till the site.
This plugin is free to use and published under the MIT license. If you use this plugin for commercial purposes, or you want to show your appreciation. support me with a donation.
Manually
Download and copy the plugin into your plugin folder: /site/plugins/
With Composer
composer require microman/kirby-inherit
Let's say you want to get a hero image. The editor can set it on each page. But he don't have an image for every page. Use this code to look if the parent page has a image set:
$page->hero_image()->inherit()
It goes all way up. At the end it will take the imgae from the main site.
You can also use it for another page:
$page->hero_image()->inherit( page('another_site') )
MIT
Do you like this Plugin? Buy me a ☕️