我正在使用 Magento 的 Fishpig WordPress 扩展(带有 CPT 扩展),但我似乎无法根据当前帖子的类型确定如何加载侧边栏块。我只想在以下情况下加载特定块:
- 我正在查看一个类型为的帖子
recipe
- 我正在查看该类型的存档
recipe
- 我正在查看自定义分类的术语页面
recipe_category
对于单个帖子视图,我在 local.xml 中添加了该块,如下所示:
<wordpress_post_view>
<reference name="right">
<remove name="wordpress.widget.categories" />
<block type="wordpress/sidebar_widget_categories" name="wordpress.widget.recipe_categories" before="-" as="recipe_categories" template="wordpress/sidebar/widget/categories.phtml">
<action method="setTitle"><title>Recipe Categories</title></action>
<action method="setTaxonomy"><title>recipe_category</title></action>
</block>
</reference>
</wordpress_post_view>
这很好,我只需要弄清楚如何将其限制为仅针对recipe
帖子类型显示。recipe
档案和recipe_category
分类术语档案也是如此。