Looking For Advice On How To Implement A Preview System For My Shortcode

Hi there,

I’m looking for some advice with regard to the best advice/architecture for a conference scheduling system plugin I’m making.

So far I have been able to make a plugin which has:

* Sessions & Speakers as types of WordPress Post. These posts have custom fields that are provided through Advanced Custom Fields (ACF)
* A Schedule Page which uses a shortcode. This shortcode makes a WP\_Query call for all of the published sessions and then puts them all into a CSS Grid that looks very similar to this example here [https://css-tricks.com/building-a-conference-schedule-with-css-grid/](https://css-tricks.com/building-a-conference-schedule-with-css-grid/)

This has worked relatively well so far but there have been occasions where an update to a session’s time or location has caused issues with how the session ends up being rendered in the CSS Grid (so for example, sessions appearing in columns it’s not supposed to). This is because while I can preview an individual session/speaker record, as the shortcode is content on another web page, there isn’t any mechanism by which I can then preview how any changes would look in the CSS grid before it is published.

So to deal with this, I think the most obvious solution would be to make a restricted page that essentially shows a preview version of the schedule which then I or whoever is using it would then press a “publish” button to then show on a public facing schedule page

So what I’m looking for is advice on how best to achieve this? The options I see are as follows:

1. Add some hidden advanced custom fields to my speaker and session post types which would then get overwritten when the publish button is pressed. These hidden fields would then be referenced by the public facing schedule
2. Essentially have a duplicate post for each session/speaker (but as their own post types). The idea would then be that when the publish button is pressed, then the duplicate version of the session/speaker is updated (which is then used by the public facing schedule)

These are both solutions that I would feel relatively comfortable implementing. However, I would also like to provide a way of being able to go back to a previous version of a schedule and while my speaker and session posts do have revisions, I haven’t really tried restoring revisions programatically before.

So my third and final idea would be to actually have two copies of the website, one that is public facing and one that is used by editors. Here the idea would be that I and any editors would make any edits, check how the schedule looks and then press a publish button that would then publish the changes to the version of the site that is public facing.

However, this isn’t something I have ever really done before so how realistic would this be as a solution? To be clear, I know that hosting providers do offer functionality for creating staging sites that can then be pushed to a public site but what I would be looking for is a way of being able to replicate this but through pressing a button on a WordPress website.

I would appreciate it if anyone could provide their opinion on which of the three options would be best or if there is another option I have missed?


1 Comment
  1. Would making this a Gutenberg block solve this issue?

    Also, are you saying your plugin needs ACF to be installed to work?


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer