From 5850e2d6fc5aa4057775a65536a0c9248a8d2574 Mon Sep 17 00:00:00 2001 From: dmtrpro <32617371+dmtrpro@users.noreply.github.com> Date: Mon, 9 Oct 2017 13:31:38 +0300 Subject: [PATCH 1/3] Added arguments to functions Added functionality to get custom headers, footers and sidebars. --- Twig/Extension/ThemeExtension.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Twig/Extension/ThemeExtension.php b/Twig/Extension/ThemeExtension.php index f246ea1..70f8c7d 100644 --- a/Twig/Extension/ThemeExtension.php +++ b/Twig/Extension/ThemeExtension.php @@ -45,9 +45,9 @@ public function getFunctions() /** * Displays Wordpress theme header (and administration menu bar if available). */ - public function getHeader() + public function getHeader($name = null) { - \get_header(); + \get_header($name); \_wp_admin_bar_init(); \wp_admin_bar_render(); @@ -56,17 +56,17 @@ public function getHeader() /** * Displays Wordpress theme sidebar. */ - public function getSidebar() + public function getSidebar($name = null) { - \get_sidebar(); + \get_sidebar($name); } /** * Displays Wordpress theme footer. */ - public function getFooter() + public function getFooter($name = null) { - \get_footer(); + \get_footer($name); } /** From 1f48d5f776bb0d20d96ef8e6bd4cc615ac16f610 Mon Sep 17 00:00:00 2001 From: DmitryPro <32617371+dmtrpro@users.noreply.github.com> Date: Mon, 6 Nov 2017 00:36:43 +0300 Subject: [PATCH 2/3] Added PHPdoc --- Twig/Extension/ThemeExtension.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Twig/Extension/ThemeExtension.php b/Twig/Extension/ThemeExtension.php index 70f8c7d..02d5c47 100644 --- a/Twig/Extension/ThemeExtension.php +++ b/Twig/Extension/ThemeExtension.php @@ -44,6 +44,8 @@ public function getFunctions() /** * Displays Wordpress theme header (and administration menu bar if available). + * + * @param string|null $name */ public function getHeader($name = null) { @@ -55,6 +57,8 @@ public function getHeader($name = null) /** * Displays Wordpress theme sidebar. + * + * @param string|null $name */ public function getSidebar($name = null) { @@ -63,6 +67,8 @@ public function getSidebar($name = null) /** * Displays Wordpress theme footer. + * + * @param string|null $name */ public function getFooter($name = null) { @@ -71,6 +77,9 @@ public function getFooter($name = null) /** * Displays a Wordpress theme template part. + * + * @param string $name + * @param string|null $name */ public function getTemplatePart($slug, $name = null) { From 9d178df6eab2ea14039dcfa3e722f0efd159fcfd Mon Sep 17 00:00:00 2001 From: DmitryPro <32617371+dmtrpro@users.noreply.github.com> Date: Mon, 6 Nov 2017 13:06:13 +0300 Subject: [PATCH 3/3] Update ThemeExtension.php --- Twig/Extension/ThemeExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Twig/Extension/ThemeExtension.php b/Twig/Extension/ThemeExtension.php index 02d5c47..3adeffa 100644 --- a/Twig/Extension/ThemeExtension.php +++ b/Twig/Extension/ThemeExtension.php @@ -78,7 +78,7 @@ public function getFooter($name = null) /** * Displays a Wordpress theme template part. * - * @param string $name + * @param string $slug * @param string|null $name */ public function getTemplatePart($slug, $name = null)