Magento 的新手(wordpress 开发人员),我在 Magento 中为这个概念而苦苦挣扎,不知道如何用他们的 api 来实现这一点并设置一个 if body class = x 的变量
简而言之,如果主体有一个“x”类,那么就会发生这种情况(我正在尝试针对特定类,所以如果子页面有一个“其他”类,例如,那么它将运行 if 或 elseif该页面):
<?php if ($this->getLayout()->createBlock("page/html")->getBodyClass() == 'home'): ?>
//add this content
<?php elseif($this->getLayout()->createBlock("page/html")->getBodyClass() == 'options'):?>
//add different divs content etc
<?php else: ?>
//stuff
<?php endif; ?>