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.
Available Blocks
Section titled “Available Blocks”Categories Block
Section titled “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
Section titled “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
Section titled “Archive Block”Displays a monthly archive list.
Block class: OrangeCollar\WordPressIntegration\Block\Sidebar\Archive
Template: OrangeCollar_WordPressIntegration::sidebar/archive.phtml
Search Block
Section titled “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
Section titled “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:
| Argument | Default | Description |
|---|---|---|
count | 5 | Number of posts |
show_thumbnail | 0 | Show thumbnail images |
Adding Sidebar Blocks via Layout XML
Section titled “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 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.