=== Webtend Business Hours Manager ===
Contributors:      webtendhq,devhasib
Tags:              business hours, opening hours, holiday, schedule, schema
Requires at least: 6.2
Tested up to:      7.1
Requires PHP:      7.4
Stable tag:        1.0.0
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Display your business hours, real-time open/closed status, holiday schedule, and Schema.org markup — all in one lightweight plugin.

== Description ==

**Webtend Business Hours Manager** is a complete business hours management system for WordPress. Show your customers exactly when you're open, automatically update to "Closed" status after hours, and let search engines discover your opening times through Schema.org markup — all without any coding.

Whether you run a local shop, a restaurant, a clinic, or a service business, Webtend Business Hours Manager gives you everything you need in a clean, fast, and developer-friendly package.

= ✅ Features =

**Weekly Schedule Builder**
Set open and close times for each day of the week. Add multiple time slots per day to handle lunch breaks or split shifts — up to 4 slots per day.

**Live Open/Closed Status**
A real-time badge automatically shows whether you're currently open or closed, with a next-open/next-close countdown. Updates via AJAX without page reload.

**Holiday & Special Dates Manager**
Mark specific dates as closed or with custom hours. Holidays always override the weekly schedule. Easily manage upcoming and past entries from the admin.

**Timezone Support**
Configure a dedicated timezone for your location. All open/closed calculations run against your local time, not the server clock.

**Schema.org Markup**
Automatically outputs a `LocalBusiness` JSON-LD script with your `openingHours` property. Improves rich results in Google Search — no configuration needed.

**Gutenberg Block**
Insert your business hours table anywhere using the native block editor. Live server-side preview in the editor. Supports wide/full alignment and colour controls.

**Classic Widget**
Add business hours to any widget area via Appearance → Widgets. Supports both the block-based widget editor and classic widget screens.

**Shortcode**
Use `[webtend_business_hours]` anywhere — pages, posts, sidebars, custom templates. Optional `show_status` attribute to toggle the live badge.

= 🔌 Integration =

* Works with any WordPress theme — block themes, classic themes, and page builders
* No template overrides — output is injected via hooks and shortcodes only
* AJAX status refresh works without page reload
* Zero jQuery dependency — vanilla ES6 throughout
* Translation-ready with full `.pot` file



= 👨‍💻 For Developers =

Webtend Business Hours is built with extensibility in mind:

* Clean PSR-4 namespace structure under `WebtendBusinessHours\`
* Full filter/action API for overriding output, schema data, and status logic
* `webtend_bh_output_schema` filter — conditionally disable JSON-LD per page
* `webtend_bh_schema_type` filter — change `LocalBusiness` to any Schema.org type
* `webtend_bh_schema_data` filter — add custom fields (address, phone, geo) to the schema

== Installation ==

1. Upload the `webtend-business-hours` folder to the `/wp-content/plugins/` directory, or install directly via the WordPress plugin installer.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **Business Hours** in the WordPress admin sidebar.
4. Configure your weekly schedule on the **Weekly Schedule** tab.
5. Add any holidays on the **Holidays** tab.
6. Adjust timezone and display options on the **Settings** tab.
7. Add the Gutenberg block, widget, or shortcode `[webtend_business_hours]` to your pages.

== Frequently Asked Questions ==

= Does this plugin work with WooCommerce? =

Yes. The free version works alongside WooCommerce with no conflicts. WooCommerce-specific features (checkout disable, order cutoff countdown, click & collect) are coming in the Pro version.

= How does the live status update work? =

The plugin uses a lightweight AJAX poll (configurable interval, default 60 seconds). The status badge updates without a page reload. Set the interval to 0 in Settings to disable automatic refresh entirely.

= Can I show different hours for a lunch break? =

Yes. Each day supports up to 4 time slots. Add a morning slot (e.g. 09:00–12:00) and an afternoon slot (13:00–17:00) to show a lunch break.

= What happens on a holiday? =

Holidays override the weekly schedule entirely. You can mark a holiday as fully closed, or set custom hours for that day (e.g. reduced Christmas Eve hours).

= Does it affect my SEO? =

Yes, positively. The plugin outputs a `LocalBusiness` JSON-LD schema block with `openingHours` property, which Google uses to display opening hours in rich results and Knowledge Panels.

= Is it compatible with block themes? =

Yes. The Gutenberg block, shortcode, and widget all work with block themes (FSE), classic themes, and page builders.

= How do I add my address and phone to the schema? =

Use the `webtend_bh_schema_data` filter to merge additional Schema.org properties:

`add_filter( 'webtend_bh_schema_data', function( $schema ) {
    $schema['telephone'] = '+1-800-555-0100';
    $schema['address']   = array(
        '@type'           => 'PostalAddress',
        'streetAddress'   => '123 Main St',
        'addressLocality' => 'Springfield',
    );
    return $schema;
} );`



== Screenshots ==

1. Weekly schedule builder — toggle days, add multiple time slots for lunch breaks
2. Live open/closed status badge on the frontend
3. Holiday manager — add closed dates or custom hours for special dates
4. Settings panel — timezone, labels, Schema.org toggle
5. Gutenberg block with live editor preview
6. Classic widget in the widget editor

== Changelog ==

= 1.0.0 =
* UX: Save buttons are now disabled during AJAX requests to prevent accidental double-saves on slow connections and re-enabled automatically after the request completes (success or error).
* UX: Holiday date picker now shows an inline warning when a past date is selected, preventing stale holiday entries.
* SEO: Updated plugin tags to include `holiday`, `schema`, and `opening hours` for better WordPress.org directory discovery.
* Weekly schedule builder with multi-slot support per day
* Holiday / special dates manager with DB storage
* Real-time open/closed AJAX status badge
* Timezone-aware status calculations
* Schema.org LocalBusiness JSON-LD output
* Gutenberg block (server-side rendered)
* Classic WordPress widget
* Shortcode `[webtend_business_hours]`
* Settings: timezone, time format, custom labels, schema toggle, refresh interval
* Plugin action links and requirements check on activation

== Upgrade Notice ==

= 1.0.0 =
Initial release. No upgrade steps required.
