Skip to content

[Epic] Template Restructuring: Patterns, Parts, and Templates Migration #794

@tibiii

Description

@tibiii

Epic Summary

Migrate Tour Operator's template system to follow WordPress best practices for patterns, template parts, and templates. This restructuring prepares the plugin for WordPress 6.9 compatibility and improves maintainability.

Current Issues

  • Patterns are buried in includes/patterns/, which doesn't follow the WordPress best practice of having a patterns/ folder at plugin root
  • No dedicated template parts folder (parts/)
  • Some template content can and should be extracted to patterns or parts
  • Existing patterns lack proper PHP headers, i18n support, and accessibility features

Goals

  • Move patterns to root level patterns/ directory (WordPress standard)
  • Create parts/ directory for template parts
  • Refactor existing patterns with proper headers, categories, i18n, and ARIA labels
  • Extract repeated template sections into reusable patterns
  • Create post type-specific patterns (Tours, Accommodation, Destinations)
  • Update templates to use <!-- wp:template-part --> and <!-- wp:pattern --> blocks

Linked Stories/Tasks

Proposed File Structure

tour-operator/
├── patterns/                                   # Root level (WordPress standard)
│   ├── # Cards (Categories: lsx-to-cards + post type)
│   ├── accommodation-card.php
│   ├── destination-card.php
│   ├── review-card.php
│   └── tour-card.php
│   │
│   ├── # Hero (Category: lsx-to-hero)
│   ├── hero-cover.php
│   └── hero-archive.php
│   │
│   ├── # Sections (Category: lsx-to-featured)
│   ├── section-heading.php
│   ├── gallery-section.php
│   ├── map-section.php
│   ├── videos-section.php
│   └── enquire-button.php
│   │
│   ├── # Related Content
│   ├── related-tours.php
│   ├── related-accommodation.php
│   └── related-destinations.php
│   │
│   ├── # Tours (Category: lsx-to-tours)
│   ├── sidebar-tour.php
│   ├── itinerary-section.php
│   ├── itinerary-list.php
│   └── include-exclude.php
│   │
│   ├── # Accommodation (Category: lsx-to-accommodation)
│   ├── sidebar-accommodation.php
│   ├── units-section.php
│   └── units-list.php
│   │
│   ├── # Destinations (Category: lsx-to-destinations)
│   ├── sidebar-destination.php
│   ├── travel-information.php
│   └── regions-list.php
│   │
│   ├── # Modals
│   ├── modal-accommodation.php
│   ├── modal-destination.php
│   └── modal-tour.php
│   │
│   ├── # Archives (Category: lsx-to-archives)
│   ├── archive-query-tours.php
│   ├── archive-query-accommodation.php
│   ├── archive-query-destinations.php
│   └── archive-query-reviews.php
│   │
│   └── # Pricing
│       └── price-display.php
│
├── parts/                                       # Template parts
│   ├── section-breadcrumbs.html
│   └── section-pagination.html
│
└── templates/                                   # Block templates (same location)
    ├── archive-*.html
    └── single-*.html

Pattern Requirements

  • PHP Headers with Title, Slug, Description, Keywords, Categories, Block Types, Post Types, Viewport width, Inserter visibility
  • Register "Tour Operator" pattern categories (lsx-to-cards, lsx-to-tours, lsx-to-accommodation, lsx-to-destinations, lsx-to-hero, lsx-to-featured, lsx-to-archives, lsx-to-pricing)
  • Wrap strings with PHP for translation (i18n)
  • Add block bindings where needed
  • Ensure accessible code with ARIA labels
  • Restrict patterns to relevant post types

Milestones & Timeline

  • Target Release: 2.1.0
  • WordPress Compatibility: 6.9+

Acceptance Criteria

  • All linked stories/tasks completed
  • patterns/ directory created at plugin root with all patterns
  • parts/ directory created with template parts
  • All patterns have proper PHP headers and categories
  • All patterns support i18n (translatable strings)
  • All patterns include accessibility features (ARIA labels)
  • Templates updated to use patterns and template parts
  • Figma-to-WordPress workflow documented
  • Documentation and changelog updated
  • Tests/QA complete for all templates

Dependencies / Blockers

  • None identified

Additional Context

Documentation References

Example Pattern Header

<?php
/**
 * Title: Name 
 * Slug: tour-operator/name
 * Description: Description of the pattern goes here.
 * Keywords: tag1, tag2, tag3
 * Categories: lsx-to-tours, lsx-to-cards
 * Block Types: core/query-loop
 * Post Types: tour
 * Viewport width: 1400
 * Inserter: no 
 *  
 * @package Tour_Operator
 * @since 2.1.0
 */
?>
<!-- Block code here. -->

Reference Themes


Definition of Ready (DoR)

  • Epic goal and scope defined
  • Linked stories/tasks listed
  • Milestones and timeline mapped
  • Dependencies/blockers identified
  • Estimate added (if applicable)
  • Stakeholders/approvers listed

Definition of Done (DoD)

  • All linked stories/tasks completed and closed
  • Documentation/changelog updated
  • QA and testing complete
  • Milestone closed and release notes prepared

Sub-issues

Metadata

Metadata

Assignees

Type

Projects

Status

Needs Triage

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions