As the WordPress customizer becomes more widely adopted by theme and plugin developers, users often have a host of live preview options to play with when personalizing their sites. Different combinations can produce wildly different designs. What if you could save a preview of customizations before going live with it? This is the idea behind the new Customize Snapshots plugin from Weston Ruter, Derek Herman, and the team at XWP.
Customize Snapshots lets you draft and preview customizer states that can be shared via a private URL that the plugin generates. Users who are not authenticated can preview snapshots on the frontend without loading the customizer. Authenticated users will be able to load the snapshot inside the customizer to make further edits or publish the draft.
You may not be able to see it in the demo above, but snapshots can be saved with a scope of full or dirty, according to the plugin details page:
- Full: will playback all the settings during preview [changeset]
- Dirty: will only playback the ones that were marked dirty when the snapshot was taken [snapshot]
“Snapshots was written as a feature plugin to implement a key feature that the Customizer Transactions proposal will make possible,” Weston Ruter said. Ruter is the Technology Director at XWP and a co-maintainer of WordPress’ core customizer component. He said the plugin was also developed specifically for a client’s project requirements.
“Customize Snapshots stores the Customizer state in a custom post type,” he said. “You can access the frontend of the site with the UUID for the snapshot added as a URL parameter to load the site with that Customizer state applied. So this makes it possible to preview Customizer changes on other devices entirely.”
Coming Soon: Schedule Customizier Changes to Go Live at a Future Date
WordPress core lacks the ability to schedule out changes to content that has already been published. The only option for editing published posts is to push changes live. This is also the same for the customizer, but the XWP team is aiming to add scheduling to Customize Snapshots.
“The idea here, though not implemented yet in the feature plugin, is that you could also schedule a snapshot (aka transaction) to go live at a certain time,” Ruter said. “So you could bundle up a bunch of changes in the Customizer and ‘Save & Publish’ at a scheduled time, like Sunday at midnight.”
With transactions added to the customizer, users could build up a large ‘changeset’ as a draft, including things like building new pages, adding a collection of widgets, and updating menu items. The entire set of changes can then be scheduled to go live at the same time.
“On the other side of that coin, it allows for there to be revision history for changes made in the Customizer,” Ruter said. “And this will work seamlessly with the Customize Posts feature plugin – the goal being to let the author do as much as possible during a Customizer session, for all changes to be previewed together, submitted for review and iteration, and staged for publishing at some point in time.”
Ruter said he sees Customize Snapshots as another take on the common desire to build out content on a staging environment, preview changes, and then promote those changes to production.
“This is a hard problem to solve, and lots of plugins are available with solutions, like WP-CFM, Ramp, and others,” he said. “But in the Customizer it’s something you can get for free because of its model, and you don’t need multiple environments. You just need to indicate which snapshot/transaction state you want to preview.”
If you previously had a difficult time grasping the technical details of Ruter’s customizer transactions proposal, the Customize Snapshots plugin is a perfect example of the kind of functionality that transactions would enable. The feature plugin is an adaptation of his proposed changes that implement the more fundamental “transactions” construct.
Customize Snapshots adds to XWP’s collection of plugins that extend the customizer in innovative ways and intersect with the framework’s long-term roadmap. Occasionally, this will also tie into client work, as with the case of Customize Snapshots.
“We try to propose Customizer solutions for client projects as a way to fund Customizer advances, but we also believe in the Customizer and would be working on it regardless,” Ruter said.
Customize Snapshots makes the customizer a more collaborative environment within WordPress. If you need to make a large number of changes and share a preview with others, this plugin will help you do that. The ability to see snapshots in the admin and schedule changes will make it even more useful in the future.
Source: WP Tavern