Caption rotation: multiple template variants per service #155
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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_groupcolumn to#__mokosuitecross_templates:service_typeandvariant_groupare rotation candidatesAlternative (simpler)
Use the existing template body with a
{random:opt1|opt2|opt3}placeholder syntax:This avoids schema changes and is more intuitive.
Acceptance Criteria
{random:opt1|opt2|opt3}placeholder resolved at render timeImplemented in commit
7e5ff12.{random:opt1|opt2|opt3}placeholder resolved inrenderTemplate()viapreg_replace_callback. Usesarray_rand()for selection. Resolved after standard placeholders but before custom field lookup, so you can combine:{random:Check out|Read|New:} {title}.