feat: register do_shortcode() as Twig function (v1.0.7)
Adds do_shortcode to TwigService::registerWordPressFunctions() so child
themes and partials can render WordPress shortcodes directly inside Twig
templates via {{ do_shortcode('[shortcode]') }}.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
59b79d23df
commit
876be4a041
3 files changed
+11
-1
No files matched your search
@@ -132,6 +132,10 @@ class TwigService
|
||||
return wp_kses_post($content);
|
||||
}, ['is_safe' => ['html']]));
|
||||
|
||||
$this->twig->addFunction(new TwigFunction('do_shortcode', function (string $content): string {
|
||||
return do_shortcode($content);
|
||||
}, ['is_safe' => ['html']]));
|
||||
|
||||
// Formatting.
|
||||
$this->twig->addFunction(new TwigFunction('number_format_i18n', function (float $number, int $decimals = 0): string {
|
||||
return number_format_i18n($number, $decimals);
|
||||
|
||||
Reference in new issue
Block a user