Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 440 Bytes

site-methods.md

File metadata and controls

21 lines (14 loc) · 440 Bytes

Site methods

Site methods can be seen as global methods, attached to the $site object.

Place this code in a plugin:

site::$methods['test'] = function($site, $arg1 = '', $arg2 = '') {
  return $site->homePage() . ' ' . $arg1 . ' ' . $arg2;
};

Add this into a template or a snippet:

<?php echo $site->test('testing', 12345); ?>

Source

https://forum.getkirby.com/t/get-path-to-assets-images/1304/8