=== Relatedly ===
Contributors:      iamkingsleyf, kraftysprouts
Tags:              related posts, related content, related articles, content recommendation, post suggestions
Requires at least: 5.0
Tested up to:      7.0
Requires PHP:      7.4
Stable tag:        2.3.3
License:           GPLv2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Related posts inline, at end of content, and in a floating sidebar. Built-in analytics and multiple themes. No slow random sorting.

== Description ==

**Related posts everywhere — inline in your content, at the end, in RSS feeds, and in a floating sidebar.**

Relatedly automatically finds and displays related posts to keep readers engaged, increase page views, and reduce bounce rate. Unlike other plugins, Relatedly places posts **inside** your content at natural breaks (not just at the bottom), shows them in a **floating sidebar**, and gives you **built-in analytics** to measure what works.

#### What Makes Relatedly Different

* **Inline Posts** — Insert related posts between paragraphs at configurable intervals (up to 5 per article free). 3 themes included free.
* **End-of-Content** — Show related posts after the article (up to 5 free). 3 layout themes included free.
* **Floating Sidebar** — A sticky sidebar with 5 design variants and auto-refresh, available with paid plans.
* **Built-in Analytics** — Click and impression tracking plus basic stats included free. Advanced charts, comparisons, and CSV export available with paid plans.
* **Email Reports** — Weekly or monthly performance reports delivered to your inbox, available with paid plans.
* **Performance First** — Pool-based queries ordered by date. Transient caching. Conditional asset loading. No slow random sorting.
* **Easy Customization** — Change colours, fonts, spacing, and labels from the settings page. No coding needed.

#### Free Features

* 3 inline themes: Simple, Minimal, Featured
* 3 end-content themes: List, Simple List, Compact
* Up to 5 inline posts and 5 end-content posts per article
* Category, tag, or both matching
* RSS feed integration with UTM tracking (up to 3 posts in feeds)
* Post + page support
* Exclude categories and tags
* Configurable cache duration
* 77 inline + 50 end-content randomized labels
* Click and impression tracking with basic statistics
* WordPress Customizer-compatible styling
* Current post exclusion

#### Paid Plan Features

* +5 inline themes: Quote, Badge, Callout, Gradient, Card
* +3 end-content themes: Masonry Grid, Carousel Slider, Timeline
* **Unlimited inline posts** per article (up to 20 end-content posts)
* **Floating Sidebar** — 5 design variants, auto-refresh, scroll-triggered display
* **Advanced Statistics Dashboard** — charts, date filtering, CTR breakdowns, top posts, source analytics, comparison reports
* **Email Reports** — weekly/monthly scheduled HTML reports
* **Manual Curation** — hand-pick related posts per article
* **Custom Post Types** — beyond posts and pages
* **Gutenberg Block** — drag-and-drop related posts anywhere
* **Statistics Export** (CSV)
* **RSS** — up to 10 posts in feeds
* **Priority Support**

#### Live Examples

See Relatedly running on real sites:

* [Animal of Things — Dog Breeds for Seniors](https://animalofthings.com/dog-breeds-for-seniors/)
* [Homequirer — Dyslexia vs Autism](https://homequirer.com/difference-between-dyslexia-and-autism/)

These example sites are owned by the plugin developer.

== Installation ==

1. Upload the `relatedly` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Go to **Relatedly → Settings** to configure display options
4. Enable the display locations you want after reviewing the settings

== Frequently Asked Questions ==

= Does this plugin slow down my site? =

No. Relatedly fetches a pool of recent posts ordered by date, caches the pool per post, and shuffles the results in PHP. This avoids the slow random-sorting pattern used by many related post plugins.

= Can I customise the look of related posts? =

Yes. Each theme's colours, fonts, and spacing are configurable from the settings page. You can also add your own CSS under **Appearance → Customize → Additional CSS**.

= Does it work with custom post types? =

The free version supports Posts and Pages. Custom post types are available with paid plans.

= Does it work with RSS feeds? =

Yes. Enable RSS integration in **Settings → RSS Feed**. Related posts are added inline and at the end of each feed item, with configurable UTM parameters for tracking.

= Is click tracking GDPR compliant? =

When tracking is enabled, the plugin stores source post ID, clicked post ID, display type, event type, IP address, user agent string, and timestamp in your WordPress database. This data is never transmitted to external servers. You can disable tracking entirely in **Settings → General**. The plugin integrates with WordPress's built-in personal data export and erasure tools.

= How do I disable related posts on specific posts? =

Use the post exclusion options in **Settings → General**.

== Screenshots ==

1. Settings page — General tab
2. Inline related post — Simple theme
3. End-of-content related posts — List theme
4. Floating sidebar widget
5. Statistics dashboard
6. Theme customization options

== Changelog ==

= 2.3.3 =
* Changed: replaced the placeholder letter mark in the Relatedly settings header with the plugin SVG logo
* Changed: refreshed admin stylesheet loading so visual fixes appear immediately after updating
* Fixed: Relatedly WordPress admin menu icon now displays visibly in the dark admin sidebar
* Fixed: Relatedly settings header logo now appears on a neutral background
* Fixed: release metadata updated to 2.3.3

= 2.3.2 =
* Added: standard plugin icon assets for WordPress admin and release package contexts
* Changed: new installs now keep display locations, RSS insertion, caching, and click tracking turned off until the site owner enables them
* Changed: Pro upgrade buttons now open the Freemius checkout flow instead of the customer login screen
* Fixed: upgrade links on the settings header, premium sidebar, Statistics page, Email Reports page, and Floating Sidebar page
* Fixed: release metadata updated to 2.3.2

= 2.3.1 =
* Fixed: premium package activation fatal on Linux hosts caused by floating sidebar variant path casing not matching the Composer PSR-4 namespace
* Changed: release metadata updated to 2.3.1 after the premium package hotfix

= 2.3.0 =
* Added: WordPress-native admin settings rebuild with compact tabs, scoped custom CSS, and cleaner sidebar boxes
* Added: basic statistics for free users, including clicks, views, click rate, display-type rates, top clicked posts, recent summary, and stored row count
* Added: advanced statistics dashboard with KPI cards, daily charts, sortable tables, and CSV export
* Added: display-type breakdown showing clicks and CTR for inline, end-content, and floating sidebar
* Added: top source posts analytics showing which posts drive the most related-post clicks
* Added: per-post analytics modal with performance as a clicked post and as a source post
* Added: period comparison tool comparing two date ranges side by side
* Changed: statistics now has one dedicated screen under Relatedly > Statistics, while tracking settings live under Relatedly > Settings > General
* Changed: theme selectors now use dropdown fields instead of large selection cards
* Changed: inline and end-of-post previews now stay with their relevant settings instead of repeating in sidebar views
* Changed: dashboard summary widget now shows basic statistics for free users when tracking is enabled
* Changed: statistics JavaScript rewritten for faster, smoother interactions
* Changed: statistics page redesigned with date range filter and exportable reports
* Removed: duplicate Statistics settings tab and unused statistics settings templates
* Fixed: free users can view basic statistics instead of only recording tracking data in the background

= 2.2.0 =
* Changed: redesigned admin settings UI with sidebar navigation and expandable module cards
* Changed: reorganized plugin navigation into Setup, Display Locations, Distribution, and Analytics
* Changed: Relatedly settings now default to the General setup tab while direct tab links still open their target screen
* Changed: moved version and plan status into a top plugin header
* Changed: moved the primary Upgrade to Pro action into the plugin header and Pro feature pages
* Changed: toggle switches replace checkboxes for boolean options
* Changed: each theme has its own expandable card with colour pickers and controls built in
* Changed: Pro-gated pages show an upgrade teaser with feature highlights instead of disabled fields
* Added: hero section with title and description per settings tab
* Added: top plugin header with current version, plan badge, and free-tier upgrade CTA
* Added: Pro theme teaser card in the Inline tab for free users
* Added: exclusions card shows live count of active exclusion rules
* Changed: General settings split into 3 focused cards instead of one long table
* Fixed: Relatedly sidebar no longer slides underneath the WordPress admin sidebar
* Fixed: removed the sidebar footer upgrade button and sidebar version footer to avoid WP admin menu overlap
* Fixed: Pro navigation items open in-plugin preview pages instead of behaving like dead sidebar links
* Fixed: Statistics, Floating Sidebar, and Email Reports free states use consistent Pro preview layouts

= 2.1.3 =
* Added: inline theme appearance controls (colours, sizes, weights, excerpt toggles)
* Added: end-content theme appearance controls (colours, sizes, weights, excerpt toggles, thumbnail size)
* Added: floating sidebar variant appearance and behaviour controls (colours, scroll percentage, dismiss behaviour, auto-refresh)
* Added: live theme preview for floating sidebar variants
* Added: General settings fields for Exclude Categories, Exclude Tags, Link Rel, and Cache Duration
* Added: Reset to Defaults button on settings page
* Changed: Exclude Categories and Exclude Tags now use searchable multi-select dropdowns instead of long checkbox lists
* Fixed: Clear Cache button now submits via POST with a valid nonce
* Fixed: floating sidebar variants registered so the live theme preview works for all variants

= 2.1.2 =
* Fix: save settings from one tab without resetting values from other tabs

= 2.1.1 =
* Fix: move data pruning cron scheduling to init action to avoid WordPress 6.7+ translation loading notice

= 2.1.0 =
* Freemius integration for premium licensing and checkout
* Premium feature gating: floating sidebar, advanced statistics dashboard, email reports, CSV export, custom post types, and advanced themes are Pro-only
* Free tier: 3 inline themes, 3 end-content themes, up to 5 inline/end-content posts, post + page support, up to 3 RSS posts
* Tracking still records clicks and impressions on the free tier

= 2.0.7 =
* Fix escaping in floating sidebar variant label
* Fix prepared SQL usage in statistics queries

= 2.0.3 =
* Remove languages/.gitkeep and dev markdown files from distribution package
* Include composer.json when vendor/ is bundled

= 2.0.2 =
* Restore Plugin URI to https://kraftysprouts.com/portfolio/relatedly/

= 2.0.1 =
* WordPress.org review compliance: wire email report scheduling, remove custom CSS field, update premium upsell copy
* Remove bundled jQuery — use WordPress core jQuery for DataTables
* Upgrade SweetAlert2 to a privacy-safe release
* Remove manual text-domain loading — translations load automatically on WordPress.org
* Update Plugin URI and contributors list

= 2.0.0 =
* Complete rebuild — modern architecture and cached post pools for better performance
* All third-party libraries bundled locally (Choices.js, Tippy.js, SweetAlert2, Flatpickr, Chart.js, DataTables)
* Options now defined in a single schema so defaults, sanitization, and settings UI stay in sync
* Colours set through CSS variables instead of inline styles on every element
* Theme output moved to editable template files
* GDPR data export and erasure hooks added
* Batched impression tracking (one request per group of posts)
* Monthly tracking data pruning cron added

= 1.9.15 =
* Namespace refactor completed (ksm_relatedly → relatedly)
* Table schema version tracking added

= 1.9.13 =
* Option and hook prefix changed from ksm_relatedly_ to relatedly_

= 1.8.8 =
* Critical fix: boolean options no longer reset to defaults on page load

= 1.8.5 =
* Label management system — disable individual default labels from admin UI

= 1.8.4 =
* RSS end-content related posts added
* UTM parameter customization added

= 1.8.3 =
* Floating sidebar added (5 variants)

= 1.7.0 =
* Statistics dashboard, click tracking, email reports added

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 2.0.0 =
Major rebuild. Settings and tracking data are preserved. Deactivate v1.x and activate v2.0.0 — no manual migration needed.

== Support ==

* [Documentation](https://kraftysprouts.com/docs/relatedly/)
* [Support Forum](https://wordpress.org/support/plugin/relatedly/)
* [Contact](https://kraftysprouts.com/contact/)

== Credits ==

Built by [Krafty Sprouts Media, LLC](https://kraftysprouts.com).

Third-party libraries included in this plugin:
* [Choices.js](https://github.com/Choices-js/Choices) — MIT License
* [Tippy.js](https://github.com/atomiks/tippyjs) — MIT License
* [Popper.js](https://github.com/floating-ui/floating-ui) — MIT License
* [SweetAlert2](https://github.com/sweetalert2/sweetalert2) — MIT License
* [Flatpickr](https://github.com/flatpickr/flatpickr) — MIT License
* [Chart.js](https://github.com/chartjs/Chart.js) — MIT License
* [DataTables](https://github.com/DataTables/DataTables) — MIT License

== Privacy ==

This plugin collects the following data when click tracking is enabled:

* Source post ID (the post the visitor was reading)
* Clicked post ID (the related post that was clicked)
* Display type (inline, end_content, or floating)
* Event type (click or impression)
* IP address
* User agent string
* Timestamp

This data is stored in a custom table in your WordPress database. It is used solely for the statistics dashboard and email reports. It is never transmitted to external servers.

**To disable data collection:** Go to Relatedly → Settings → General and uncheck "Enable Click Tracking".

**Data retention:** Rows older than 90 days are automatically deleted by a monthly scheduled task. The retention period is configurable in Settings.

**GDPR:** This plugin integrates with WordPress's built-in personal data tools (Tools → Export Personal Data / Erase Personal Data).
