=== ICS Calendar Feed Block ===
Contributors: starlink1207
Tags: calendar, ical, ics, events, google calendar
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show any public ICS / iCal calendar feed as a month, week or list calendar block. Caching, time zones and recurring events included.

== Description ==

ICS Calendar Feed Block turns any public calendar address into a clean, mobile-friendly calendar on your site. Paste the ICS (iCal) link from Google Calendar, Outlook / Microsoft 365, Apple iCloud, Nextcloud, Proton, church management software, school systems or sports club tools — no account connection, no API keys, just the standard ICS format.

Built for churches, clubs, schools, libraries and community groups who keep their schedule in a calendar app and want it on their website without retyping events.

**Why choose it**

* **Nothing to break:** no API key, no Google sign-in and no app approval that can expire. It reads the standard public ICS address every calendar app offers.
* **A real block with live preview:** what you see in the editor is what visitors get, and the editor tells you how many events the feed has and which dates it covers.
* **Server-rendered:** calendars are plain HTML. They work without JavaScript, with page caching plugins and with any theme.
* **Keeps working when the feed is down:** feeds refresh in the background, and if the calendar server is briefly unavailable the last good copy keeps showing.
* **Correct recurring events and time zones:** repeating rules, exceptions, moved occurrences, Outlook time zone names and all-day events are handled properly.

**Features**

* **ICS Calendar block** for the block editor with live preview, plus the `[icsfb_calendar]` shortcode for classic content and widgets.
* **Feed link helper:** paste a Google Calendar ID (…@group.calendar.google.com or a Gmail address), a Google Calendar embed link or an Outlook "HTML" publish link — it is converted to the ICS address automatically. The block shows the resolved address, the number of events, the dates the feed covers and a warning when the feed has nothing for the period shown.
* **Feed colours:** optionally use the colours stored in the feed (event COLOR, calendar COLOR and Apple's calendar colour) instead of one block colour.
* **Month, week and list views** with previous / today / next navigation and an optional view switcher for visitors. Works without JavaScript.
* **Recurring events** done right: daily, weekly, monthly and yearly rules with intervals, counts, end dates, "second Sunday" or "last Friday" style rules, excluded dates, extra dates and moved or cancelled single occurrences.
* **Time zone handling**: events are converted to your site time zone, including Outlook / Exchange (Windows) zone names, UTC and floating times. All-day events never shift a day.
* **Fast and polite caching**: feeds are cached and refreshed in the background with WP-Cron, so visitors never wait on the calendar server. If a feed is briefly down, the last good copy keeps showing.
* **Feed status screen** showing the last refresh, number of events and any error, with a one-click "refresh now" button.
* **Mobile layout**: on small screens the month and week views turn into an easy-to-read agenda.
* **Looks native in any theme:** fonts, text colour and the accent colour come from your theme (block themes and classic themes, light or dark), with right-to-left support, visible keyboard focus and readable contrast.
* Accessible markup (real links, table headers, ARIA labels), translation ready, and only loads its stylesheet on pages that show a calendar.

**Shortcode examples**

`[icsfb_calendar]` — uses the default feed and view from the settings.

`[icsfb_calendar url="https://example.com/calendar.ics" view="list" limit="10" days="30"]`

`[icsfb_calendar url="abc123@group.calendar.google.com" feed_colors="yes"]`

Options: `url` (ICS / webcal address, Google Calendar ID or embed link, Outlook HTML link), `view` (month, week, list), `title`, `color`, `feed_colors` (yes/no), `limit`, `days`, `switcher` (yes/no).

**Privacy**

The plugin downloads the calendar feed you enter from your server and stores a cached copy in your database. Visitors' browsers do not contact the calendar provider. No data is sent anywhere else.

**Pro version**

ICS Calendar Feed Block Pro adds saved calendars that can be merged into one color-coded view with a clickable legend and duplicate removal, include / exclude keyword filters, colour rules by category or keyword, hiding of declined and "free" events, an accessible event detail pop-up with "Add to calendar" links (Google Calendar, Outlook.com, .ics file) and a Subscribe button, an Availability view for rental feeds such as Airbnb, Booking.com and VRBO (booked days shaded, no guest names shown), compact Mini month and Up next layouts for sidebars, and four style presets (Minimal, Bold, Dark and Pastel).

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install it from the Plugins screen.
2. Activate the plugin.
3. Go to **Settings → ICS Calendar Feed** and paste your public ICS feed URL (optional — each block can have its own).
4. Edit a page, add the **ICS Calendar** block and choose a view.

== Frequently Asked Questions ==

= Where do I find my calendar's ICS address? =

Google Calendar: Settings → your calendar → "Public address in iCal format" (the calendar must be public). Outlook: Settings → Calendar → Shared calendars → Publish a calendar → ICS link. Apple iCloud: share the calendar as a public calendar and copy the webcal:// link — the plugin converts it to https:// automatically.

= I only have a Google Calendar ID, an embed link or an Outlook HTML link. =

Paste it as it is. A Google Calendar ID (…@group.calendar.google.com or a Gmail address) and a Google embed link (calendar.google.com/calendar/embed?src=…) become the calendar's public ICS address, and an Outlook "HTML" publish link (…/calendar.html) becomes its ICS link. The calendar still has to be shared publicly. In the block settings you can see the resulting address, how many events were found and which dates the feed covers.

= The editor says the feed does not cover the period shown. =

The feed has no events in the month, week or list period on screen — for example an old calendar, or a provider that only publishes a few weeks. Check the "Covers" dates under the feed URL, then pick another calendar or period.

= Can events keep the colours from Google Calendar or iCloud? =

Yes. Turn on "Use feed colours" in the block (or use `feed_colors="yes"` in the shortcode). Event colours are used first, then the calendar colour. Not every provider includes colours in its feed; when there are none, the block colour is used.

= How often is the calendar updated? =

By default every 60 minutes; you can choose between 5 minutes and 24 hours. Use "Refresh all feeds now" on the settings screen to update immediately.

= Event times are off by some hours. =

Events are shown in the time zone set under Settings → General. Choose a city there (for example "New York" instead of "UTC-5") so daylight saving time is handled correctly.

= Can I show several calendars in one view? =

Each block shows one feed in the free version; add several blocks for several calendars. Merging calendars into one view is part of the Pro version.

= Does it work with page caching plugins? =

Yes. Calendar navigation uses normal links, so cached pages still work. The feed itself is refreshed in the background.

= What happens if the feed is unavailable? =

The last successfully downloaded copy keeps showing. Editors see the error message on the page and in the feed status table; visitors only see a short notice when no copy is available at all.

= Will the calendar match my theme? =

Yes. It uses your theme's fonts, text colour and accent colour, and transparent backgrounds, so it fits light and dark themes alike. New installs follow the theme's accent colour; you can pick a fixed colour under Settings → ICS Calendar Feed or per block. Themes can override every style.

= Are cancelled events shown? =

No. Events marked as cancelled in the feed (and cancelled single occurrences of repeating events) are always hidden.

== Screenshots ==

1. Month view of a public calendar feed with navigation and a view switcher.
2. Settings and feed status with the last refresh and number of events.

== Changelog ==

= 1.0.3 =
* New: feed link helper — Google Calendar IDs, Google embed links and Outlook HTML links are converted to ICS addresses, in the block, the shortcode and the settings.
* New: the block editor shows the resolved ICS address, the number of events, the dates the feed covers and a warning when the period shown is not covered.
* New: "Use feed colours" option (event COLOR, calendar COLOR and X-APPLE-CALENDAR-COLOR). Off for existing blocks.
* New: option to follow the theme's accent colour (on for new installs).
* Improved: front-end styles now follow the theme (inherited fonts and colours, transparent backgrounds, dark themes, right-to-left, focus styles) and are easy to override.
* Improved: the stylesheet only loads on pages that show a calendar; clearer settings descriptions and empty state.
* Pro: Availability view for rental feeds, Mini month and Up next layouts, "Add to calendar" links and single-event .ics download, Subscribe button, duplicate removal across merged calendars, hiding of declined and free events, colour rules.

= 1.0.2 =
* Hardened output escaping, input sanitizing and database queries.
* 14-day free trial of Pro from the plugin screen.

= 1.0.1 =
* Clear message when a feed URL is not a public address.
* Cleaner admin menu (no separate Contact Us item).

= 1.0.0 =
* Initial release.
