CMS Widgets
The module provides three CMS widgets for embedding WordPress content in any Magento CMS page, block, or layout position.
Available Widgets
Section titled “Available Widgets”Recent Posts Widget
Section titled “Recent Posts Widget”Displays a configurable list of the most recent blog posts.
Widget type identifier: OrangeCollar\WordPressIntegration\Block\Widget\RecentPosts
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
title | text | Recent Posts | Widget heading |
count | integer | 5 | Number of posts to display |
show_thumbnail | select | Yes | Show featured image |
show_date | select | Yes | Show post date |
category_id | integer | (none) | Filter by category ID |
Featured Post Widget
Section titled “Featured Post Widget”Displays a single highlighted post - either by specific post ID or the latest post from a category.
Widget type identifier: OrangeCollar\WordPressIntegration\Block\Widget\FeaturedPost
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
title | text | (none) | Widget heading |
post_id | integer | (none) | Specific WordPress post ID |
category_id | integer | (none) | Use latest post from this category |
show_excerpt | select | Yes | Show post excerpt |
If both post_id and category_id are set, post_id takes precedence.
Category Posts Widget
Section titled “Category Posts Widget”Displays posts from a specific WordPress category in a grid or list layout.
Widget type identifier: OrangeCollar\WordPressIntegration\Block\Widget\CategoryPosts
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
title | text | (none) | Widget heading |
category_id | integer | (required) | WordPress category ID |
count | integer | 4 | Number of posts |
layout | select | grid | grid or list |
show_thumbnail | select | Yes | Show featured image |
Adding a Widget in CMS Editor
Section titled “Adding a Widget in CMS Editor”- Edit a CMS page or block in Magento Admin
- Click Insert Widget in the page builder toolbar
- Select the widget type from the dropdown
- Configure the parameters
- Click Insert Widget to add the shortcode to the page content
Adding a Widget via Layout XML
Section titled “Adding a Widget via Layout XML”<referenceContainer name="sidebar.main"> <block class="OrangeCollar\WordPressIntegration\Block\Widget\RecentPosts" name="wordpress.recent.posts" template="OrangeCollar_WordPressIntegration::widget/recent-posts.phtml"> <arguments> <argument name="count" xsi:type="string">5</argument> <argument name="show_thumbnail" xsi:type="string">1</argument> <argument name="show_date" xsi:type="string">1</argument> </arguments> </block></referenceContainer>