Theming and Templates
The module renders blog content using standard Magento layout XML and .phtml templates. Override them in your theme using Magento’s standard theme override mechanism.
Layout Handles
Section titled “Layout Handles”Each blog page type has a dedicated layout handle. See the Layout Handles reference for the full list.
Template Files
Section titled “Template Files”All default templates are in:
app/code/OrangeCollar/WordPressIntegration/view/frontend/templates/
| Template | Purpose |
|---|---|
blog/index.phtml | Blog post listing |
blog/post/view.phtml | Single post page |
blog/category/view.phtml | Category archive |
blog/tag/view.phtml | Tag archive |
blog/author/view.phtml | Author archive |
blog/search/results.phtml | Search results |
menu.phtml | WordPress navigation menu |
widget/recent-posts.phtml | Recent posts widget |
widget/featured-post.phtml | Featured post widget |
widget/category-posts.phtml | Category posts widget |
sidebar/categories.phtml | Sidebar categories |
sidebar/tags.phtml | Sidebar tags |
sidebar/archive.phtml | Sidebar archive |
sidebar/search.phtml | Sidebar search |
sidebar/recent-posts.phtml | Sidebar recent posts |
ViewModels
Section titled “ViewModels”Three ViewModels are provided for use in templates:
Post ViewModel
Section titled “Post ViewModel”OrangeCollar\WordPressIntegration\ViewModel\Post
Provides helper methods for rendering a single post:
getPost(): Post- the current post data objectgetFormattedDate(Post $post): string- formatted publish dategetCanonicalUrl(Post $post): string- the Magento-side URL for the postgetCategoryUrl(Category $category): string- URL for a category archive
PostList ViewModel
Section titled “PostList ViewModel”OrangeCollar\WordPressIntegration\ViewModel\PostList
Provides helper methods for listing pages:
getPosts(): array- array of Post objectsgetCurrentPage(): intgetTotalPages(): intgetPaginationUrl(int $page): string
Breadcrumbs ViewModel
Section titled “Breadcrumbs ViewModel”OrangeCollar\WordPressIntegration\ViewModel\Breadcrumbs
Used by BreadcrumbPlugin to build breadcrumb trails for all blog page types.
Overriding Templates
Section titled “Overriding Templates”To override a template in your theme, copy it to:
app/design/frontend/Your/Theme/OrangeCollar_WordPressIntegration/templates/
maintaining the same relative path as the original.
For example, to override the post view template:
app/design/frontend/Your/Theme/OrangeCollar_WordPressIntegration/templates/blog/post/view.phtml