From adaae208e3857cf56b37a809f6a105e05819323d Mon Sep 17 00:00:00 2001 From: Ludovic Date: Mon, 30 Nov 2020 16:14:34 +0100 Subject: [PATCH] Add a ShortcodesManager using a dummy example --- .../app/Managers/ShortcodesManager.php | 48 +++++++++++++++++++ .../themes/<%= slug %>/functions.php | 2 + .../templates/shortcodes/example.twig | 10 ++++ 3 files changed, 60 insertions(+) create mode 100644 template/web/wp-content/themes/<%= slug %>/app/Managers/ShortcodesManager.php create mode 100644 template/web/wp-content/themes/<%= slug %>/templates/shortcodes/example.twig diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/ShortcodesManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/ShortcodesManager.php new file mode 100644 index 0000000..1fa5e87 --- /dev/null +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/ShortcodesManager.php @@ -0,0 +1,48 @@ + __( 'Default foo param value', 'studiometa' ), + ), + $params + ); + + return Timber::compile( + 'shortcodes/example.twig', + array( + 'foo' => $attr['foo'], + ) + ); + } +} diff --git a/template/web/wp-content/themes/<%= slug %>/functions.php b/template/web/wp-content/themes/<%= slug %>/functions.php index 62c4a4f..5a6aad2 100644 --- a/template/web/wp-content/themes/<%= slug %>/functions.php +++ b/template/web/wp-content/themes/<%= slug %>/functions.php @@ -15,6 +15,7 @@ use Studiometa\Managers\AssetsManager; use Studiometa\Managers\CustomPostTypesManager; use Studiometa\Managers\ManagerFactory; +use Studiometa\Managers\ShortcodesManager; use Studiometa\Managers\TaxonomiesManager; use Studiometa\Managers\ThemeManager; use Studiometa\Managers\TwigManager; @@ -64,6 +65,7 @@ function () { new AssetsManager(), new CustomPostTypesManager(), new TaxonomiesManager(), + new ShortcodesManager(), <%_ if (acf) { _%> new ACFManager(), <%_ } _%> diff --git a/template/web/wp-content/themes/<%= slug %>/templates/shortcodes/example.twig b/template/web/wp-content/themes/<%= slug %>/templates/shortcodes/example.twig new file mode 100644 index 0000000..ec9694c --- /dev/null +++ b/template/web/wp-content/themes/<%= slug %>/templates/shortcodes/example.twig @@ -0,0 +1,10 @@ +{# +/** + * @file + * Example shortcode + * + * Available variables: + * - foo + */ +#} +Shortcode value is {{ foo }}