ORANGECOLLAR/MODULE-WORDPRESS-INTEGRATION · LAYOUT HANDLES
Layout Handles
The Observer/LayoutLoadBefore.php observer dynamically adds a layout handle to every blog page request. These handles allow targeted layout customization per page type.
Layout Handles
| Handle | Page | Layout File |
|---|---|---|
orangecollar_ | Blog post listing | view/ |
orangecollar_ | Single post page | view/ |
orangecollar_ | Category archive | view/ |
orangecollar_ | Tag archive | view/ |
orangecollar_ | Author archive | view/ |
orangecollar_ | Search results | view/ |
How Handles Are Added
The handle name is constructed as orangecollar_{controller}_{action}:
- Controller name: the request controller name (set by the Router based on the URL pattern matched)
- Action: the controller action name (
index,view,results)
For the post view controller, the handle is orangecollar_post_view. For the blog index controller, it is orangecollar_blog_index.
Using Layout Handles in Your Theme
To add content to the blog listing page sidebar in your theme:
File: app/design/frontend/Your/Theme/OrangeCollar_WordPressIntegration/layout/orangecollar_blog_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="sidebar.main">
<block class="OrangeCollar\WordPressIntegration\Block\Sidebar\Categories"
name="blog.sidebar.categories"
template="OrangeCollar_WordPressIntegration::sidebar/categories.phtml"
after="-"/>
</referenceContainer>
</body>
</page> To apply changes to all blog page types at once, use a layout update that references all six handles.