=== Mephivio Sommaire ===
Contributors: mephivio34
Tags: posts, categories, directory, ajax, multilingual
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Display an elegant, multilingual category summary of your WordPress posts with search, filters, pagination and shortcode support.

== Description ==

Mephivio Sommaire adds a responsive post summary grouped by category. It is designed for blogs, magazines, knowledge bases and editorial websites that need a readable index of published articles.

Use the shortcode:

`[flappy_sommaire]`

...or add the "Mephivio Sommaire" block directly from the block inserter — same rendering, same settings, with a live preview and an inspector panel in the editor. A native Elementor widget is also available (no need to paste the shortcode into an HTML widget).

Main features:
* Native Gutenberg block ("Mephivio Sommaire" in the block inserter) and a native Elementor widget, alongside the shortcode.
* Any public content type (posts by default, pages, portfolio, WooCommerce products…) grouped by any public taxonomy: categories, tags, WooCommerce product categories or a custom taxonomy.
* Optional nested subcategories, shown right after their parent category.
* 1 to 4 columns, globally or per shortcode / block / widget.
* Optional author and estimated reading time under each title, and a "Last updated" sort.
* Shareable filters: the active category is reflected in the URL (`?sommaire-cat=slug`).
* Optional Schema.org ItemList structured data (JSON-LD).
* Manual, drag-and-drop category ordering.
* Two thumbnail layouts: compact (52×52) or a full-width "magazine card" style.
* Optional view counter per post (works with page caching), with a "Popularity" sort option.
* Export and import settings as a JSON file — handy for duplicating a configuration across several client sites.

* Category-based post summary.
* Live search on titles and excerpts, including full server-side search across all articles when pagination or infinite scroll is active.
* Clickable category filters, with accessible aria-pressed state.
* Optional thumbnails (responsive srcset), dates and excerpts.
* Pagination or infinite scroll.
* Light rendering mode, or an optional mode that follows the visitor's browser/system light-dark preference.
* Configurable colors, typography and responsive breakpoint.
* Server-side token handling for safer pagination and search, through the REST API (`mephivio-sommaire/v1`) with an automatic admin-ajax fallback. Works on pages served by a page cache.
* Cached category grouping for better performance on high-traffic pages, automatically refreshed when posts, categories or settings change.
* Multilingual interface: French, English, German, Spanish, Portuguese and Breton.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/mephivio-sommaire/` directory, or install the plugin through the WordPress Plugins screen.
2. Activate the plugin through the Plugins screen in WordPress.
3. Go to Settings > Mephivio Sommaire to configure the display.
4. Add `[flappy_sommaire]` to a page or post, drag the "Mephivio Sommaire" block into the block editor, or drag the "Mephivio Sommaire" widget into an Elementor layout.

== Frequently Asked Questions ==

= Which shortcode should I use? =

Use `[flappy_sommaire]`.

= Can I override settings for one page only? =

Yes. Example:

`[flappy_sommaire order="ASC" order_by="modified" show_search="0" show_filter="0" exclude_cats="3,7" pagination="pagination" per_page="5" multi_cat="all" columns="3"]`

The Gutenberg block and Elementor widget expose the same overrides through their own settings panel; the content type, taxonomy, category order, thumbnail style and view counter remain global settings (Settings > Mephivio Sommaire), shared by the shortcode, the block and the widget.

= Can I link to a pre-filtered summary? =

Yes. Add `?sommaire-cat=` followed by the category slug to the page URL, for example `https://example.com/summary/?sommaire-cat=news`. Clicking a filter updates the URL automatically.

= Does it work with page caching (LiteSpeed Cache, WP Rocket…)? =

Yes. Since 1.5.0, pagination, infinite scroll, server-side search and the view counter keep working on pages served from a page cache.

= Can I group WooCommerce products by product category? =

Yes. In Settings > Mephivio Sommaire > General, choose "Products" as the content type and "Product categories" in "Group by".

= Which languages are included? =

The plugin includes French, English, German, Spanish, Portuguese and Breton translation files.

= Why is the default theme forced to light? =

The plugin ships with a "Forced light" mode by default to keep its appearance consistent no matter the visitor's browser or system settings. If you'd rather have the summary follow the visitor's light/dark preference, switch "Display mode" to "Follow browser / system" in Settings > Mephivio Sommaire > Advanced.

= Does the view counter collect personal data? =

No. It only stores a simple integer per post (how many times it has been viewed). No IP address, cookie or visitor identifier is recorded; the browser only sends the post ID, and uses session storage to avoid counting the same tab twice. Views from logged-in users who can edit posts (administrators, editors) and from known bots are not counted.

= Can I use this with a custom post type instead of regular posts? =

Yes, as long as that post type is public and attached to at least one public taxonomy. Pick it from the "Content type" dropdown, then the taxonomy from "Group by", in Settings > Mephivio Sommaire > General.

== Screenshots ==

1. Front-end category summary with filters.
2. Settings screen with display and style options.
3. Translation settings.

== Changelog ==

= 1.5.0 =
* Fixed: fatal error on WordPress 6.0 to 6.4 when the `[flappy_sommaire]` shortcode was used without any attribute.
* Fixed: with block themes, the summary was rendered before its scripts were registered, so pagination, infinite scroll, server-side search and custom colors did not work.
* Fixed: custom colors and font sizes from the settings were ignored (overridden by the default stylesheet values).
* Fixed: responsive thumbnails (srcset/sizes) were stripped on the first page load.
* Fixed: on pages served by a page cache, pagination, infinite scroll and server-side search stopped working after a few hours (expired nonce and tokens). Tokens now last 7 days and loading errors keep the current content with a message.
* Fixed: the view counter now counts through a small script, so it also works with page caching; known bots are ignored.
* Fixed: client-side search now handles accented uppercase letters (É, À…).
* Fixed: uninstall now removes the view counter post meta.
* Fixed: importing a malformed settings file could cause a fatal error; 3-digit colors (#fff) are converted to 6 digits.
* Fixed: infinite scroll no longer skips a page after a network error.
* Improved: cache invalidation ignores revisions, autosaves and other content types (menus, WooCommerce orders…).
* Improved: accessibility (keyboard alternative to drag and drop, linked labels, view count announced as text), translated results count and block editor strings.
* Removed: deprecated Elementor hook (Elementor < 3.5).
* Added: any public taxonomy can be used to group content (tags, WooCommerce product categories, custom taxonomies).
* Added: optional nested subcategories.
* Added: 1 to 4 columns (`columns` shortcode attribute, block and Elementor setting).
* Added: "Last updated" sort, optional author and reading time.
* Added: shareable filters through the URL (`?sommaire-cat=slug`).
* Added: optional Schema.org ItemList structured data (JSON-LD), with the `flappy_sommaire_schema` filter.
* Added: client-side search also looks in the displayed excerpt.
* Added: REST API routes `mephivio-sommaire/v1/load-more` and `/search` (read-only), with automatic admin-ajax fallback.

= 1.4.0 =
* Added: manual, drag-and-drop category ordering (Settings > General). Categories not reordered manually keep their alphabetical position, appended after the ordered ones.
* Added: "magazine card" thumbnail layout (full-width image) as an alternative to the compact 52×52 thumbnail (Settings > Style).
* Added: native Elementor widget ("Mephivio Sommaire", under the General category), with its own settings panel — no more pasting the shortcode into an HTML widget. Only loaded when Elementor is active.
* Added: optional per-post view counter (simple integer post meta, no personal data collected, admin/editor views excluded) and a new "Popularity" sort option (Settings > General & Advanced).
* Added: export and import settings as a JSON file (Settings > Advanced) — useful for duplicating a configuration across several client sites. Imported values go through the exact same validation as the settings form; nothing from the file is trusted as-is.
* Added: content type selector (Settings > General) — the summary can now pull from any public custom post type registered on the "Category" taxonomy, not just regular posts. Applies to the shortcode, the block and the Elementor widget.
* Fixed: saving settings now always invalidates the cached category/post grouping introduced in 1.3.8, so changes to sorting, exclusions, category order or content type are reflected immediately rather than waiting for the cache to expire.
* Changed: the Gutenberg block's "Sort by" control and the shortcode's `order_by` attribute also accept "popularity".

= 1.3.8 =
* Added: native Gutenberg block ("Mephivio Sommaire"), available from the block inserter alongside the shortcode, with a settings panel and live preview in the editor.
* Fixed: "Follow browser/system" display mode had no effect (missing dark-mode CSS) — now implemented via prefers-color-scheme.
* Fixed: live search now also searches posts not yet loaded on screen when pagination or infinite scroll is active (new server-side AJAX search, still session-token based, never exposes raw IDs to the client).
* Fixed: renamed the non-standard "br_FR" Breton locale code to the correct ISO code "br" (existing saved settings are migrated automatically).
* Fixed: Tested up to updated to WordPress 7.1.
* Added: category/post grouping is now cached via transients, automatically invalidated on post or category changes, to reduce repeated query work on high-traffic pages.
* Added: thumbnails now use wp_get_attachment_image() for native responsive srcset/sizes output instead of a single fixed-size URL.
* Added: accessible aria-pressed state on category filter buttons.
* Changed: pagination transient tokens are only written once (previously re-written on every page view).

= 1.3.7 =
* Maintenance release: internal hardening pass ahead of the 1.3.8 feature update.

= 1.3.6 =
* Fixed escaping issues reported by Plugin Check before WordPress.org submission.
* Added translator comments for placeholder-based strings.
* Removed legacy bundled translation loading calls and uses direct MO loading for forced locales.
* Updated Tested up to metadata to 7.0.
* Removed direct database cleanup from uninstall to avoid direct database query warnings.

= 1.3.4 =
* Renamed plugin classes and constants with a safer Mephivio Sommaire prefix.
* Completed bundled Spanish, Portuguese and Breton translation files.
* Updated POT/PO metadata to version 1.3.4.
* Removed obsolete development README from the release ZIP.
* Kept bundled language loading for forced locales even when the locale is not installed in WordPress.
* Updated WordPress.org readme metadata for public distribution.

= 1.2.1 =
* Forced light theme by default for consistent browser rendering.
* Improved query performance.
* Added stable AJAX transients.
* Added advanced settings and uninstall cleanup.

= 1.2.0 =
* Improved AJAX security.
* Added server-side token handling.

== Upgrade Notice ==

= 1.5.0 =
Fixes a fatal error on WP 6.0-6.4, ignored custom colors, and pagination with block themes or page caching. Adds taxonomy choice, nested subcategories, columns and structured data. New options default to 1.4.0 behavior.

= 1.4.0 =
Adds manual category order, magazine card thumbnails, an Elementor widget, a view counter with popularity sort, settings export/import and custom post type support. Safe update: new options default to the 1.3.8 behavior.

= 1.3.8 =
Adds a native Gutenberg block, fixes the dark-mode display option and live search during pagination, and caches category grouping for better performance. Safe update, no breaking changes.

= 1.3.6 =
Plugin Check cleanup release for WordPress.org submission.

= 1.3.4 =
Finalized WordPress.org-ready package with safer naming, completed bundled translations and cleaned release files.
