Orange Collar Media
Orange Collar Media
DOCS
ORANGECOLLAR/MODULE-WORDPRESS-INTEGRATION · SIDEBAR BLOCKS

Sidebar Blocks

  • Magento
  • Adobe Commerce
  • Hyvä

The module includes five pre-built blocks for building a blog sidebar. Add them to your layout XML using the blog layout handles.

Available Blocks

Categories Block

Displays a list of all WordPress categories with post counts.

Block class: OrangeCollar\WordPressIntegration\Block\Sidebar\Categories Template: OrangeCollar_WordPressIntegration::sidebar/categories.phtml

Tags Block

Displays a tag cloud of all WordPress tags.

Block class: OrangeCollar\WordPressIntegration\Block\Sidebar\Tags Template: OrangeCollar_WordPressIntegration::sidebar/tags.phtml

Archive Block

Displays a monthly archive list.

Block class: OrangeCollar\WordPressIntegration\Block\Sidebar\Archive Template: OrangeCollar_WordPressIntegration::sidebar/archive.phtml

Search Block

A search form targeting the blog search endpoint.

Block class: OrangeCollar\WordPressIntegration\Block\Sidebar\Search Template: OrangeCollar_WordPressIntegration::sidebar/search.phtml

Recent Posts Block

A compact recent posts list for the sidebar.

Block class: OrangeCollar\WordPressIntegration\Block\Sidebar\RecentPosts Template: OrangeCollar_WordPressIntegration::sidebar/recent-posts.phtml

Arguments:

ArgumentDefaultDescription
count5Number of posts
show_thumbnail0Show thumbnail images

Adding Sidebar Blocks via Layout XML

To add sidebar blocks to all blog pages, create a layout file in your theme:

app/design/frontend/Your/theme/OrangeCollar_WordPressIntegration/layout/orangecollar_blog_index.xml

XML LAYOUT
<?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"/>
            <block class="OrangeCollar\WordPressIntegration\Block\Sidebar\RecentPosts"
                   name="blog.sidebar.recent"
                   template="OrangeCollar_WordPressIntegration::sidebar/recent-posts.phtml"/>
        </referenceContainer>
    </body>
</page>

To add blocks to all blog pages at once, use the default layout handle (sidebar blocks will appear on all pages) or apply the blocks to each blog layout handle individually.