Skip to content

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.

Each blog page type has a dedicated layout handle. See the Layout Handles reference for the full list.

All default templates are in: app/code/OrangeCollar/WordPressIntegration/view/frontend/templates/

TemplatePurpose
blog/index.phtmlBlog post listing
blog/post/view.phtmlSingle post page
blog/category/view.phtmlCategory archive
blog/tag/view.phtmlTag archive
blog/author/view.phtmlAuthor archive
blog/search/results.phtmlSearch results
menu.phtmlWordPress navigation menu
widget/recent-posts.phtmlRecent posts widget
widget/featured-post.phtmlFeatured post widget
widget/category-posts.phtmlCategory posts widget
sidebar/categories.phtmlSidebar categories
sidebar/tags.phtmlSidebar tags
sidebar/archive.phtmlSidebar archive
sidebar/search.phtmlSidebar search
sidebar/recent-posts.phtmlSidebar recent posts

Three ViewModels are provided for use in templates:

OrangeCollar\WordPressIntegration\ViewModel\Post

Provides helper methods for rendering a single post:

  • getPost(): Post - the current post data object
  • getFormattedDate(Post $post): string - formatted publish date
  • getCanonicalUrl(Post $post): string - the Magento-side URL for the post
  • getCategoryUrl(Category $category): string - URL for a category archive

OrangeCollar\WordPressIntegration\ViewModel\PostList

Provides helper methods for listing pages:

  • getPosts(): array - array of Post objects
  • getCurrentPage(): int
  • getTotalPages(): int
  • getPaginationUrl(int $page): string

OrangeCollar\WordPressIntegration\ViewModel\Breadcrumbs

Used by BreadcrumbPlugin to build breadcrumb trails for all blog page types.

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