Skip to content

janizde/opening-hours-shortcode-builder

Repository files navigation

Opening Hours Shortcode Builder 🧰 🔮 Build Status

The Opening Hours Shortcode Builder offsers a UI for interactively building shortcodes for the Opening Hours WordPress Plugin.

Demo

A demo can be seen at https://janizde.github.io/opening-hours-shortcode-builder/

Options

The shortcode builder can be given initial options, such as the available sets that the user can choose among. These options are contained in an option object whose JSON representation is then base64 encoded and set as the hash portion in the url.

{
  "sets": {
    "0": "First Set",
    "3": "Second Set"
  },
  "shortcode": "op-is-open"
}

The URL then looks like

https://domain.com/path/to/shortcode/builder#eyJzZXRzIjp7IjAiOiJGaXJzdCBTZXQiLCIzIjoiU2Vjb25kIFNldCJ9fQ==eyJzZXRzIjp7IjAiOiJGaXJzdCBTZXQiLCIzIjoiU2Vjb25kIFNldCJ9LCJzaG9ydGNvZGUiOiAib3AtaXMtb3BlbiJ9
Name Type Description
sets object<string, string> Object mapping set it to set name. The specified sets will be used as selectable presets fpr the set id
shortcode string String containing the initial shortcode id. Possible values are op-overview, op-is-open, op-holidays or op-irregular-openings

This project was bootstrapped with Create React App.

Changelog

v2.3.0

  • Add validation for required set_id field to prevent invalid shortcodes from being copied

© 2020 Jannik Portz – License

About

Shortcode builder UI for the Opening Hours WordPress plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published