Skip to content

Menus Configuration

The Menus group enables fetching and rendering WordPress navigation menus within Magento pages.

Admin path: Stores > Configuration > Orange Collar > WordPress Integration > Menus

Enables the menu fetching system. When disabled, no menu API calls are made to WordPress.

  • Default: No (disabled)

When enabled, the module fetches menu data from the WordPress oc-bridge/v1/menus endpoint, which returns the full menu tree including labels, URLs, and nesting levels.

The response structure from /wp-json/oc-bridge/v1/menus looks like:

[
{
"id": 1,
"name": "Primary Navigation",
"slug": "primary",
"items": [
{
"id": 10,
"title": "Home",
"url": "https://blog.example.com/",
"parent": 0,
"children": []
},
{
"id": 11,
"title": "About",
"url": "https://blog.example.com/about/",
"parent": 0,
"children": [
{
"id": 12,
"title": "Our Team",
"url": "https://blog.example.com/about/team/",
"parent": 11,
"children": []
}
]
}
]
}
]

To render a WordPress menu in a Magento layout, add a block to your layout XML:

<block class="OrangeCollar\WordPressIntegration\Block\Menu"
name="wordpress.menu.primary"
template="OrangeCollar_WordPressIntegration::menu.phtml">
<arguments>
<argument name="menu_location" xsi:type="string">primary</argument>
</arguments>
</block>

The menu_location argument accepts either a menu location slug or a menu slug directly.

Menu data is cached with the WORDPRESS_MENU cache tag. When a WordPress navigation menu is updated, the oc-magento-bridge plugin sends a webhook that purges this tag, causing the next page load to fetch fresh menu data.