This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// create srcset images for kirby | |
function img($image, $options = array()) { | |
// defaults | |
$defaults = array( | |
"alt" => $image->title()->or(''), | |
"widths" => [100, 100, 100], | |
"class" => "", | |
"lazy" => false, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php function try_snippet($try, $data = [], $return = false) { | |
$snippets = kirby::instance()->roots()->snippets(); | |
foreach ( $try as $snippet ) { | |
$file = $snippets . DS . $snippet . '.php'; | |
if ( f::exists($file) ) { | |
return tpl::load($file, $data, $return); | |
} else { | |
continue; | |
} | |
} |