=== SoftNav ===
Contributors: mrkohan
Tags: navigation, performance, ajax, spa, page-transitions
Requires at least: 5.8
Tested up to: 7.2
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Soft page navigation without full reloads. Safer defaults for guests, checkout, and account pages.

== Description ==

SoftNav makes browsing feel faster by loading the next page in the background and swapping only the main content. Your header and footer stay in place, and a short transition plays while the new content appears.

It is built as a progressive enhancement: every URL still returns normal server-rendered HTML for search engines and visitors without JavaScript.

= Features =

* Soft navigation for guest visitors
* Staff and editors never receive SoftNav (full page loads only)
* Sensitive routes always full-load: `/wp-admin`, login, checkout, account, feeds, REST, and similar paths
* Scripts and unsafe handlers are stripped from fetched HTML before insert
* Optional prefetch on hover or touch
* Theme-friendly events after each soft navigation
* Disable SoftNav for one visit with `?softnav=0`

= Settings =

Go to **Settings → SoftNav** to:

* Enable or disable SoftNav
* Choose the content CSS selector to swap
* Add extra URL fragments to skip
* Toggle prefetch
* Optionally enable SoftNav for regular logged-in users (admins/editors stay excluded)

= For theme developers =

After SoftNav swaps content, listen for:

* `softnav:before` — fired before navigation starts
* `softnav:after` — fired after the swap; `event.detail.root` is the new content root

Re-initialize sliders, forms, or other front-end widgets inside that handler.

To skip SoftNav on a single link, add class `no-soft` or attribute `data-no-soft`.

== Installation ==

1. Upload the `softnav` folder to the `/wp-content/plugins/` directory, or install the zip from Plugins → Add New.
2. Activate SoftNav through the Plugins screen.
3. Open Settings → SoftNav and review the content selector and excluded paths for your theme.

== Frequently Asked Questions ==

= Does SoftNav hurt SEO? =

No. SoftNav does not create separate URLs or replace server HTML. Crawlers and users without JavaScript still receive a normal full page.

= Is it safe for WooCommerce or membership sites? =

By default SoftNav runs only for guests. Checkout, cart, account, and admin routes always use a full page load. You can add more path fragments under Excluded paths.

= Will it work with my theme? =

Yes, if your theme has a clear main content wrapper such as `main`, `#main`, `#content`, or `.site-main`. SoftNav tries those selectors by default; you can change the selector in settings.

= How do I exclude one link? =

Add class `no-soft` or the `data-no-soft` attribute to that link.

= How do I exclude custom checkout or account URLs? =

Add one URL fragment per line under Settings → SoftNav → Excluded paths. Core security paths are always enforced even if you remove them from the list.

= How can themes re-init scripts after a soft navigation? =

Listen for the `softnav:after` event on `document` and run your init code on `event.detail.root`.

== Changelog ==

= 1.0.0 =
* Initial public release
* Soft content swap with animated transition
* Guests-only mode with hard skip paths for admin, checkout, and account routes
* Prefetch on hover or touch
* Settings screen for selector, skip paths, prefetch, and logged-in behavior
* Theme events: `softnav:before` and `softnav:after`
* Translation-ready (text domain: softnav)

== Upgrade Notice ==

= 1.0.0 =
First release. After install, open Settings → SoftNav and confirm the content selector matches your theme.
