Display on tags/categories

[MAILPOET-3120]
This commit is contained in:
Pavel Dohnal
2020-09-08 15:27:22 +02:00
committed by Veljko V
parent 5a864f4f42
commit 3f65aaee8d
3 changed files with 70 additions and 3 deletions

View File

@@ -187,8 +187,11 @@ class DisplayFormInWPContent {
return false;
}
if ($this->wp->isSingular('post') && $this->shouldDisplayFormOnPost($setup, 'posts')) {
return true;
if ($this->wp->isSingular('post')) {
if ($this->shouldDisplayFormOnPost($setup, 'posts')) return true;
if (isset($setup['categories']) && $this->wp->hasCategory($setup['categories'])) return true;
if (isset($setup['tags']) && $this->wp->hasTag($setup['tags'])) return true;
return false;
}
if ($this->wp->isPage() && $this->shouldDisplayFormOnPost($setup, 'pages')) {
return true;
@@ -197,7 +200,7 @@ class DisplayFormInWPContent {
return false;
}
private function shouldDisplayFormOnPost($setup, $postsKey): bool {
private function shouldDisplayFormOnPost(array $setup, string $postsKey): bool {
if (!isset($setup[$postsKey])) {
return false;
}