settings_page.php
58 lines
| 1 | <?php if (!defined('WPINC')) { die; } ?> |
| 2 | <div class="wrap"> |
| 3 | <h2><?php echo _x('Zenchef widget settings', 'widget.backoffice.settings_page.title', 'zenchef-widget-integration') ?></h2> |
| 4 | <form action="options.php" method="POST"> |
| 5 | <?php settings_fields($settings_group_slug); ?> |
| 6 | <?php do_settings_sections($page_slug) ?> |
| 7 | <?php submit_button() ?> |
| 8 | </form> |
| 9 | |
| 10 | <div class="card" style="max-width: 800px;"> |
| 11 | <h2><?php echo _x('Per-page shortcode', 'widget.backoffice.settings_page.shortcode_section_title', 'zenchef-widget-integration') ?></h2> |
| 12 | <p> |
| 13 | <?php echo _x('Drop the shortcode into any post or page to render the widget inline. Without attributes, it uses the settings above:', 'widget.backoffice.settings_page.shortcode_intro', 'zenchef-widget-integration') ?> |
| 14 | </p> |
| 15 | <p><code>[zenchef_widget]</code></p> |
| 16 | <p> |
| 17 | <?php echo _x('Every setting above can be overridden per-page. Useful for sites managing several restaurants or for landing pages with custom styling:', 'widget.backoffice.settings_page.shortcode_overrides_intro', 'zenchef-widget-integration') ?> |
| 18 | </p> |
| 19 | <p><code>[zenchef_widget restaurant_id="367219" language="fr" primary_color="#cc0000" position="center" auto_open="0" hide_button="1"]</code></p> |
| 20 | |
| 21 | <h3><?php echo _x('Available attributes', 'widget.backoffice.settings_page.shortcode_attributes_title', 'zenchef-widget-integration') ?></h3> |
| 22 | <table class="widefat striped" style="max-width: 760px;"> |
| 23 | <thead> |
| 24 | <tr> |
| 25 | <th style="width: 30%;"><?php echo _x('Attribute', 'widget.backoffice.settings_page.shortcode_table.attribute_header', 'zenchef-widget-integration') ?></th> |
| 26 | <th><?php echo _x('Accepted values', 'widget.backoffice.settings_page.shortcode_table.values_header', 'zenchef-widget-integration') ?></th> |
| 27 | </tr> |
| 28 | </thead> |
| 29 | <tbody> |
| 30 | <tr><td><code>restaurant_id</code></td><td><?php echo _x('Your Zenchef restaurant ID. Falls back to the value set above.', 'widget.backoffice.settings_page.shortcode_table.restaurant_id', 'zenchef-widget-integration') ?></td></tr> |
| 31 | <tr><td><code>language</code></td><td><code>en</code>, <code>fr</code>, <code>es</code>, <code>it</code>, <code>de</code>, <code>pt</code>, <code>nl</code></td></tr> |
| 32 | <tr><td><code>primary_color</code></td><td><?php echo _x('Hex colour, e.g.', 'widget.backoffice.settings_page.shortcode_table.primary_color_prefix', 'zenchef-widget-integration') ?> <code>#cc0000</code> (<?php echo _x('only applied when', 'widget.backoffice.settings_page.shortcode_table.primary_color_condition', 'zenchef-widget-integration') ?> <code>use_default_color="0"</code>)</td></tr> |
| 33 | <tr><td><code>use_default_color</code></td><td><code>1</code> (<?php echo _x('use Zenchef OS colour', 'widget.backoffice.settings_page.shortcode_table.use_default_color_on', 'zenchef-widget-integration') ?>) <?php echo _x('or', 'widget.backoffice.settings_page.shortcode_table.or', 'zenchef-widget-integration') ?> <code>0</code> (<?php echo _x('use the primary_color above', 'widget.backoffice.settings_page.shortcode_table.use_default_color_off', 'zenchef-widget-integration') ?>)</td></tr> |
| 34 | <tr><td><code>position</code></td><td><code>left</code>, <code>center</code>, <code>right</code></td></tr> |
| 35 | <tr><td><code>auto_open</code></td><td><code>1</code> (<?php echo _x('open automatically', 'widget.backoffice.settings_page.shortcode_table.auto_open_on', 'zenchef-widget-integration') ?>) <?php echo _x('or', 'widget.backoffice.settings_page.shortcode_table.or', 'zenchef-widget-integration') ?> <code>0</code> (<?php echo _x('only on click', 'widget.backoffice.settings_page.shortcode_table.auto_open_off', 'zenchef-widget-integration') ?>)</td></tr> |
| 36 | <tr><td><code>open_delay</code></td><td><?php echo _x('Delay in milliseconds before auto-opening. Only applies when', 'widget.backoffice.settings_page.shortcode_table.open_delay', 'zenchef-widget-integration') ?> <code>auto_open="1"</code></td></tr> |
| 37 | <tr><td><code>hide_button</code></td><td><code>1</code> (<?php echo _x('hide the floating button', 'widget.backoffice.settings_page.shortcode_table.hide_button_on', 'zenchef-widget-integration') ?>) <?php echo _x('or', 'widget.backoffice.settings_page.shortcode_table.or', 'zenchef-widget-integration') ?> <code>0</code></td></tr> |
| 38 | <tr><td><code>disable_gtm</code></td><td><code>1</code> <?php echo _x('or', 'widget.backoffice.settings_page.shortcode_table.or', 'zenchef-widget-integration') ?> <code>0</code></td></tr> |
| 39 | <tr><td><code>disable_ga4</code></td><td><code>1</code> <?php echo _x('or', 'widget.backoffice.settings_page.shortcode_table.or', 'zenchef-widget-integration') ?> <code>0</code></td></tr> |
| 40 | </tbody> |
| 41 | </table> |
| 42 | |
| 43 | <h3><?php echo _x('Triggering the widget from a custom button', 'widget.backoffice.settings_page.custom_button_title', 'zenchef-widget-integration') ?></h3> |
| 44 | <p> |
| 45 | <?php echo _x('The widget can be opened from any clickable element on the page (Elementor button, Gutenberg button, custom HTML, etc.) using one of the three SDK-native methods:', 'widget.backoffice.settings_page.custom_button_intro', 'zenchef-widget-integration') ?> |
| 46 | </p> |
| 47 | <ul style="list-style: disc; padding-left: 1.5em;"> |
| 48 | <li><code><button data-zc-action="open">Book a table</button></code></li> |
| 49 | <li><code><a href="#zc-action-open">Book a table</a></code></li> |
| 50 | <li><code>ZenchefWidget.open()</code> / <code>.close()</code> / <code>.toggle()</code></li> |
| 51 | </ul> |
| 52 | |
| 53 | <p class="description"> |
| 54 | <?php echo _x('Tip: in the Gutenberg block editor, insert the shortcode in a "Shortcode" block (Add Block / Shortcode) rather than a Paragraph block, so that quote characters are not auto-formatted.', 'widget.backoffice.settings_page.shortcode_gutenberg_tip', 'zenchef-widget-integration') ?> |
| 55 | </p> |
| 56 | </div> |
| 57 | </div> |
| 58 |