Display form on product pages
[MAILPOET-3210]
This commit is contained in:
@@ -187,10 +187,10 @@ class DisplayFormInWPContent {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->wp->isSingular('post')) {
|
||||
if ($this->wp->isSingular('post') || $this->wp->isSingular('product')) {
|
||||
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;
|
||||
if ($this->shouldDisplayFormOnCategory($setup)) return true;
|
||||
if ($this->shouldDisplayFormOnTag($setup)) return true;
|
||||
return false;
|
||||
}
|
||||
if ($this->wp->isPage() && $this->shouldDisplayFormOnPost($setup, 'pages')) {
|
||||
@@ -213,4 +213,18 @@ class DisplayFormInWPContent {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function shouldDisplayFormOnCategory(array $setup): bool {
|
||||
if (!isset($setup['categories'])) return false;
|
||||
if ($this->wp->hasCategory($setup['categories'])) return true;
|
||||
if ($this->wp->hasTerm($setup['categories'], 'product_cat')) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private function shouldDisplayFormOnTag(array $setup): bool {
|
||||
if (!isset($setup['tags'])) return false;
|
||||
if ($this->wp->hasTag($setup['tags'])) return true;
|
||||
if ($this->wp->hasTerm($setup['tags'], 'product_tag')) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user