=== Ariade Companion ===
Contributors: anblik
Donate link: https://ananyoo.com
Tags: accessibility, navigation, header, blocks, wcag
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Restores the Ariade theme's accessible drop-down menu header, header actions and auto-populated Sitemap block for the WordPress.org build of Ariade, and makes LinkedIn link previews show the right title and image.

== Description ==

The WordPress.org build of the Ariade theme keeps to the theme-directory rules, which do not allow a theme to register its own blocks. This small companion plugin carries those blocks instead, so a site running the WordPress.org build gets the full Ariade experience:

* **Ariade Site Header, Primary Menu and Header Actions blocks** — the simple, WCAG-friendly drop-down menu header (disclosure pattern, keyboard operable, Escape-to-close, mobile drawer) plus search, account, cart and a call-to-action button. The menu is managed the normal WordPress way under Appearance > Menus (Primary location).
* **Ariade Sitemap block** — an accessible HTML sitemap that fills itself from your content (pages, posts by year, WooCommerce products and portfolio by category) with per-section pagination. Audited with axe-core against WCAG 2.0/2.1/2.2 A and AA: 0 violations across 17 automated checks. Since 1.1.1 the companion also puts this block on the theme's Sitemap page automatically: the theme's core-blocks "Sitemap" pattern is swapped for the block whenever the plugin is active (filter `ariadec_restore_sitemap_pattern` to keep the core-blocks version).
* **One-click header switch** — after activation, a notice on the Dashboard, Themes and Plugins screens offers a single button that swaps the theme's basic header for the Ariade drop-down menu header. It is a normal template-part customisation, so the Site Editor's "Reset" undoes it at any time.
* **Header pattern** — the same header is also registered as a pattern (Patterns > Header) if you prefer to place it by hand in the Site Editor.
* **Default favicon** — on a fresh install with no Site Icon set, the Ariade "ad" icon is shown in the browser tab. The moment a Site Icon is chosen it steps aside. It also stays quiet when the classic Ariade theme or the Ariade Demo plugin already provides the same fallback.
* **LinkedIn-friendly link previews** — LinkedIn reads WordPress's oEmbed discovery links before the Open Graph tags, and the oEmbed answer carries only the plain post title and author, so LinkedIn previews of WordPress posts normally show the wrong title, "Rich media" and no image. The companion removes the two oEmbed discovery `<link>` tags from the page head, so LinkedIn uses the same Open Graph title, description and image as Facebook, X and WhatsApp. The oEmbed endpoint itself is untouched. Switch it off with `add_filter( 'ariadec_remove_oembed_discovery', '__return_false' );` if you need other WordPress sites to auto-embed your posts.

The plugin is safe alongside the classic (full) Ariade theme: it detects the theme's own copies of these blocks and functions and steps aside automatically, so nothing is ever registered or defined twice.

== Installation ==

1. Install and activate the Ariade theme (1.5.0 or newer).
2. Upload this plugin under Plugins > Add New > Upload Plugin and activate it.
3. On the Themes screen, press "Use the Ariade header" in the notice — or place the "Ariade header (drop-down menu)" pattern into the Header template part yourself in the Site Editor.
4. Manage the menu under Appearance > Menus, assigned to the Primary location. The free Ariade Demo plugin can build the full demo menu and content in one click.

== Frequently Asked Questions ==

= What happens if I deactivate this plugin? =

The header blocks stop rendering, so a header switched to the Ariade header will show only the logo until you either reactivate the plugin or reset the Header template part in the Site Editor (Appearance > Editor > Template Parts > Header > Reset). Keep the companion active on any site that uses the Ariade header.

= Does it work with the classic full Ariade theme? =

Yes — it simply does nothing there. The classic theme carries these blocks itself, and the companion detects that and steps aside, so you can move between the two theme builds without conflicts.

= Where is the menu edited? =

Appearance > Menus, in the "Primary" location — ordinary WordPress menus, no page builder and no extra settings screen.

= Why did my LinkedIn previews show "No image found" before this plugin? =

LinkedIn's crawler prefers oEmbed data over Open Graph. WordPress advertises an oEmbed endpoint for every post and page, and that endpoint returns a "rich" answer with only the post title and author — no image — so LinkedIn showed the old post title, the type "Rich media" and no picture, even when your SEO plugin's og:title and og:image were correct. Since 1.1.0 the companion removes the two oEmbed discovery links from the page head and LinkedIn falls back to Open Graph. After updating, run your URLs through the LinkedIn Post Inspector (linkedin.com/post-inspector) once to refresh LinkedIn's cache.

= Does removing the oEmbed discovery links break anything? =

No. Embeds of YouTube, X and other sites into your own posts keep working (those use the other sites' oEmbed, not yours), and the oEmbed REST endpoint of your site stays online. The only change is that another WordPress site can no longer turn a bare link to your post into an automatic embed card; it shows a normal link instead. If you want that behaviour back, add `add_filter( 'ariadec_remove_oembed_discovery', '__return_false' );` to a small plugin or your child theme.

= My Sitemap page shows only a plain list of pages, categories and recent posts. Why? =

That is the theme's built-in fallback. The Ariade theme keeps to the WordPress.org rules, so its own "Sitemap" pattern uses core blocks only. The rich, auto-populated sitemap (hero, cards per content type, pagination) is the Ariade Sitemap block from this plugin. From version 1.1.1 the companion inserts that block into the theme's Sitemap pattern automatically, so the Sitemap page (and any child-theme page that uses the same pattern) shows the full sitemap as soon as the plugin is active. If you prefer the plain version, add `add_filter( 'ariadec_restore_sitemap_pattern', '__return_false' );`.

== Changelog ==

= 1.1.2 =
* The mobile drawer button now links to the contact page this site actually uses. It was hard coded to /contact/, so on any install that names the page differently the button spent a redirect before arriving. The lookup is cached for a day and the ariade_drawer_cta filter still overrides it.

= 1.1.1 =
* Fix: the auto-populated sitemap is back on the Sitemap page. Since Ariade 1.5.0 the theme's "ariade/sitemap" pattern is a core-blocks list, and although this plugin carried the Ariade Sitemap block, nothing inserted it into the page - so the Sitemap page (and child-theme pages such as ananyoo.com's /table-of-contents/ that reuse the pattern) lost the patterned hero, the card grid and the per-section pagination. The companion now swaps the pattern's content for the block on init (priority 30, after theme patterns and block registration), in memory only; theme files and the database are untouched. Skipped automatically when the block or the pattern is missing, or when the pattern already contains the block (classic full Ariade theme). New filter `ariadec_restore_sitemap_pattern` (default true) to keep the core-blocks version.

= 1.1.0 =
* New: LinkedIn-friendly link previews. The plugin removes the two WordPress oEmbed discovery `<link>` tags from the page head (filter `ariadec_remove_oembed_discovery`, default on). LinkedIn's crawler reads oEmbed before Open Graph and the WordPress oEmbed "rich" response has only the post title and author, so every post preview on LinkedIn showed the wrong title, "Rich media" and "No image found". With the links gone LinkedIn uses the Open Graph title, description and image, like Facebook and X. The oEmbed endpoint itself is unchanged. Placed in the companion rather than the theme because the WordPress.org theme requirements list wp_oembed_add_discovery_links as a hook a theme must not remove. Verified with the LinkedIn Post Inspector on 81 ananyoo.com URLs, 4 September 2026.

= 1.0.0 =
* First release. Carries the four Ariade blocks (site-header, primary-nav, header-actions, sitemap) moved out of the theme for WordPress.org compliance, the front-end navigation script, the header inserter pattern, the one-click header switch, and the default-favicon fallback. Safe alongside the classic full Ariade theme (all registrations and definitions are guarded).
