microman/kirby-inherit

Get field from parent page if empty

Fund package maintenance!
Other

Installs: 33

Dependents: 0

Suggesters: 0

Security: 0

Stars: 10

Watchers: 2

Forks: 1

Open Issues: 0

Type:kirby-plugin

1.0.1 2023-03-02 20:57 UTC

This package is auto-updated.

Last update: 2024-05-22 08:48:39 UTC


README

Get the field of the parent pages if it's empty or not exists. It goes all up till the site.

Overview

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.

Installation

Manually

Download and copy the plugin into your plugin folder: /site/plugins/

With Composer

composer require microman/kirby-inherit

How to use

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.

Inherit form another page

You can also use it for another page:

    $page->hero_image()->inherit( page('another_site') )

License

MIT

Do you like this Plugin? Buy me a ☕️