Skip to content

Instantly share code, notes, and snippets.

@bastianallgeier
Created June 11, 2019 13:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastianallgeier/69b7cdac9295fab2021c1a2e3d8077a8 to your computer and use it in GitHub Desktop.
Save bastianallgeier/69b7cdac9295fab2021c1a2e3d8077a8 to your computer and use it in GitHub Desktop.
Some Text with the product (product: test)
<?php
// site/plugins/products/index.php
Kirby::plugin('dantz/products', [
'tags' => [
'product' => [
'html' => function ($tag) {
if ($product = page('products/' . $tag->value())) {
return snippet('product', ['product' => $product], true);
}
return '';
}
]
]
]);
<!-- site/snippets/product.php -->
<article class="product">
<!-- image and stuff -->
<?= $product->title() ?>
</article>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment