=== Viking Casualty Monitor ===
Contributors: vikingobserver
Tags: casualties, gaza, west bank, israel, dashboard, data
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Reported casualties in the Gaza war since 7 October 2023, with Palestinian and Israeli figures clearly separated, sourced and refreshed automatically.

== Description ==

This plugin shows reported casualties from 7 October 2023 to the present. Palestinian and Israeli figures are kept in separate sections because they come from different sources and use different definitions.

**Palestinian figures**

* Gaza: daily reports from the Gaza Ministry of Health, collected by Tech for Palestine.
* West Bank: UN OCHA Protection of Civilians data, collected by Tech for Palestine.
* Categories: killed, children, women, medical staff, journalists, civil defence workers, injured, settler attacks, displaced people.

**Israeli figures**

* Published by the IDF, the Defense Ministry, the Foreign Ministry and the Israel Police, as compiled in Wikipedia's article on the Gaza war.
* Categories: total killed, civilians, security personnel, wounded (including soldiers), people captured or abducted, and the 7 October 2023 attack shown separately.

The dashboard states plainly that these are reported figures, that categories overlap, and that the two sets are not comparable line by line. Where a source says "at least", the number is shown with a plus sign.

**Automatic updates**

The plugin checks the sources twice a day by default, using WP-Cron. The schedule can be changed to once a day or manual. A "Refresh now" button is available on the dashboard, and the admin view shows the last successful refresh, the next scheduled one, which sources are live, and any fetch error. If a source is unavailable, the last good figure is kept.

**Shortcode and block**

Place `[viking_casualties]` on any page or post, or insert the **Casualty Monitor** block from the block inserter. The dashboard is public; refresh controls, settings and error details are visible only to administrators.

For tight spaces, use `[viking_casualties compact="1"]`, or turn on **Compact summary** in the block's sidebar. The compact version shows the two totals, the ratio and a link to the full breakdown.

The full version also carries a small "Open as app" dropdown that offers Android and iPhone installation, and disappears once the site is already running as an installed app.

**Showing it on every page**

In Casualties > Settings, choose a **Where it appears** option: only where you add it, a compact summary on every page and post, or the full dashboard on every page and post. That covers posts, pages, the blog index and archives. This is the only supported way to show it site-wide — do not paste the shortcode into theme template files, and do not edit theme files at all. Entries that already contain the shortcode or block are skipped, so the dashboard never appears twice.

**JSON feed for apps**

The same data is available read-only at:

`/wp-json/viking-casualties/v1/data`

It returns the totals, each category, the date each figure refers to, the source names and links, and a note on how to read the numbers. Cached for five minutes. This feed is what a mobile app would read, so the site and the app never disagree.

**Installable app, no store needed**

The dashboard can be installed to a phone home screen straight from the site. On Android, open the dashboard page and choose Install app (or Add to Home screen); on iPhone, open it in Safari and choose Share > Add to Home Screen. The plugin serves the web app manifest at `/casualties.webmanifest` and the service worker at `/casualties-sw.js`, so the app opens full screen, keeps the last loaded dashboard available offline, and refreshes in the background. No Apple or Google account is required for this. A native Android/iOS build can reuse the same JSON feed later.

== Installation ==

1. In the WordPress admin, go to Plugins > Add New > Upload Plugin.
2. Upload the ZIP and activate the plugin.
3. Open the new "Casualties" menu in the admin sidebar to see the dashboard and settings.
4. Add `[viking_casualties]` to a page or post.

The first refresh runs about a minute after activation. On a low-traffic site, WP-Cron only runs when the site receives a visit; use "Refresh now" or a real server cron job if updates look stale.

== Frequently Asked Questions ==

= Why do the Palestinian and Israeli totals differ so much? =

They come from different sources with different definitions. The Gaza figures include combatants and civilians and are not broken down that way by the source. The Israeli figures combine civilians and security personnel, and several are reported as minimums. The dashboard says this next to the numbers rather than implying a like-for-like comparison.

= Why are some Israeli figures marked with a plus? =

Because the underlying official statement says "at least". The plugin shows the minimum and marks it rather than inventing a precise number.

= Can I enter newer Israeli figures myself? =

Yes. In Casualties > Settings, turn on the manual override and enter a total, civilians and security personnel, with the date and a link to the source. Blank fields keep the fetched values.

= Where does the data come from? =

Gaza and West Bank: data.techforpalestine.org, which compiles Gaza Ministry of Health and UN OCHA figures. Israeli figures: the Wikipedia article on the Gaza war, which compiles IDF, Defense Ministry, Foreign Ministry and police statements. Every card links to its source.

= Does it work without WP-Cron? =

Yes, but figures only update when you press "Refresh now" or when a real server cron calls `wp-cron.php`. The values already stored are always shown.

== Changelog ==

= 1.0.2 =
* The site-wide summary now sits above the theme footer and carries its own white surface, so it stays readable on sites with a dark or video page background.

= 1.0.1 =
* Compact summary for every page and post, "Open as app" picker on the full dashboard, and a more reliable app start page (previews and drafts no longer overwrite it).

= 1.0.0 =
* First release: public dashboard, admin dashboard and settings, twice-daily automatic refresh, manual Israeli override, shortcode, and a read-only JSON feed at /wp-json/viking-casualties/v1/data.
* Installable web app: manifest, service worker with offline copy of the last loaded dashboard, and icons.
* Casualty Monitor block for the block editor with a compact-summary toggle, and placement options for one page, a compact summary on every page, or the full dashboard on every page.
* "Open as app" dropdown on the dashboard with Android install prompt and iPhone instructions.
