Caption rotation: multiple template variants per service #155

Closed
opened 2026-06-23 13:33:56 +00:00 by jmiller · 1 comment
Owner

Summary

Allow multiple caption variants per template. When cross-posting (especially evergreen re-shares), rotate through variants to avoid repetitive posts. Revive Old Posts (WordPress) pioneered this.

Implementation

Database

Add variant_group column to #__mokosuitecross_templates:

  • Templates with the same service_type and variant_group are rotation candidates
  • Dispatcher picks one at random (or round-robin) per post

Alternative (simpler)

Use the existing template body with a {random:opt1|opt2|opt3} placeholder syntax:

{random:Check out|Don't miss|New post:} {title}

{url}

This avoids schema changes and is more intuitive.

Acceptance Criteria

  • {random:opt1|opt2|opt3} placeholder resolved at render time
  • Random selection per post (not per placeholder instance in same template)
  • Works with evergreen re-shares for variety
  • Documented in template editor help text
## Summary Allow multiple caption variants per template. When cross-posting (especially evergreen re-shares), rotate through variants to avoid repetitive posts. Revive Old Posts (WordPress) pioneered this. ## Implementation ### Database Add `variant_group` column to `#__mokosuitecross_templates`: - Templates with the same `service_type` and `variant_group` are rotation candidates - Dispatcher picks one at random (or round-robin) per post ### Alternative (simpler) Use the existing template body with a `{random:opt1|opt2|opt3}` placeholder syntax: ``` {random:Check out|Don't miss|New post:} {title} {url} ``` This avoids schema changes and is more intuitive. ## Acceptance Criteria - [ ] `{random:opt1|opt2|opt3}` placeholder resolved at render time - [ ] Random selection per post (not per placeholder instance in same template) - [ ] Works with evergreen re-shares for variety - [ ] Documented in template editor help text
Author
Owner

Implemented in commit 7e5ff12. {random:opt1|opt2|opt3} placeholder resolved in renderTemplate() via preg_replace_callback. Uses array_rand() for selection. Resolved after standard placeholders but before custom field lookup, so you can combine: {random:Check out|Read|New:} {title}.

Implemented in commit `7e5ff12`. `{random:opt1|opt2|opt3}` placeholder resolved in `renderTemplate()` via `preg_replace_callback`. Uses `array_rand()` for selection. Resolved after standard placeholders but before custom field lookup, so you can combine: `{random:Check out|Read|New:} {title}`.
Sign in to join this conversation.
No labels
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteCross#155