Skip to content

Sidebar Blocks

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

Displays a list of all WordPress categories with post counts.

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

Displays a tag cloud of all WordPress tags.

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

Displays a monthly archive list.

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

A search form targeting the blog search endpoint.

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

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

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 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.