=== Listing Reviews for Directorist with Yelp ===
Contributors: wpdreamers
Tags: directorist, yelp, business directory, directory reviews, yelp reviews
Requires at least: 6.2
Tested up to: 6.9
Requires PHP: 7.4
Requires Plugins: directorist
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add Yelp nearby reviews to Directorist listings. Live ratings, photos, distance & price on every directory page via Yelp Fusion API.

== Description ==

**Listing Reviews for Directorist with Yelp** turns your [Directorist](https://wordpress.org/plugins/directorist/) business directory into a context-rich destination by pulling live data from the Yelp Fusion API onto every single listing. Visitors instantly see real Yelp businesses nearby — restaurants, cafés, hotels, shops — with star ratings, review counts, distance, photos, and prices, without ever leaving your directory.

If you run a WordPress directory powered by **Directorist** — a classifieds site, a real-estate directory, a restaurant or hotel directory, a city guide, or a niche business directory — this add-on adds the "what's around this place?" answer that visitors are already looking for. Pair Directorist's listing data with Yelp's review database and you turn a thin listing page into a stayable, shareable, bookmark-able page.

= Why this plugin =

Most directory sites have a discovery problem: a listing page tells you about one business, but visitors want to know "what else is nearby?" before they decide whether to visit. Linking out to Google or Yelp loses them. This Directorist add-on solves that by embedding the nearby context directly in your listing, so:

* **Visitors stay on your directory longer.** Time-on-page goes up; bounce-rate goes down.
* **Each listing becomes a mini neighborhood guide.** Better content for SEO, better experience for users.
* **No manual data entry.** Yelp's API supplies fresh reviews automatically — you never touch the data.
* **Works with every Directorist directory type.** Restaurants, hotels, retail, real estate, events, services — Yelp's category set covers them all.

= Key features =

* **Nearby businesses, on every Directorist listing.** Renders a "Nearby places" section under (or beside) every single-listing page automatically.
* **Live Yelp Fusion API integration.** Star rating, review count, photo, distance, price tier, category — all pulled fresh on render.
* **Grid view.** Clean, responsive card grid with 1–4 columns. Mobile-friendly out of the box.
* **6 built-in Yelp categories.** Restaurants, Food, Cafés, Bars, Shopping, Hotels — covering most common Directorist directory types.
* **Per-listing overrides.** Each Directorist listing can override the Yelp category and search radius from both the admin meta box and the Directorist frontend submission form.
* **Listing-submission form integration.** Yelp category + radius fields appear inside Directorist's frontend listing form, right next to the map / address fields, so submitters set their own context.
* **Modern React-based settings UI.** Tabbed admin page (General, Display, Placement, Submission Form, Cache, Operations) with a Directorist-style look and feel.
* **Placement control.** Choose sidebar (Directorist's right sidebar) or bottom-of-content placement, per-site.
* **Themeable templates.** Drop a `nearby-grid.php` (or `single-wrapper.php`) into your theme's `listing-reviews-for-directorist-with-yelp/` folder to fully customize the markup.
* **Performance-conscious.** Per-request memoization, configurable result limit (1–20), and clean Yelp HTTP wrapper with status-code instrumentation.
* **Privacy-respecting.** Only the listing's coordinates and your API key are sent — no visitor IPs, cookies, or personal data.
* **Translation-ready.** Full POT file shipped, all strings i18n-wrapped.
* **GDPR-friendly.** Yelp is called server-side, so no visitor-tracked third-party request fires from the browser.

= Pro upgrades available =

* Slider, map, and list+map view modes (with Swiper carousel and Leaflet/OpenStreetMap maps).
* Phone column, multi-category submissions, admin-only form fields.
* Live frontend filter bar — visitors filter by category, rating, price, and sort order without reloading.
* Use the visitor's own location (with browser permission) instead of the listing's coordinates.
* Smart caching with daily / weekly cron warming.
* Result-quality filters: min rating, min review count, open-now, price tiers, allowlist / blocklist Yelp IDs.
* UTM tagging + outbound click tracking per listing.
* Card themes (Yelp / Minimal / Magazine / Dark) and Custom CSS.
* Gutenberg block, Elementor widget, shortcode, public REST endpoint.

= Built for Directorist =

This is a [Directorist](https://wordpress.org/plugins/directorist/) add-on. It detects Directorist's single listing template, sidebar, frontend submission form, and post type (`at_biz_dir`) automatically — no theme hacks, no shortcode placement needed. Activate, paste your Yelp API key, and every Directorist listing gets the nearby section.

If you don't yet have Directorist installed, the plugin will prompt you to install it during activation.

== External services ==

This plugin connects to the Yelp Fusion API to fetch nearby business data (name, address, photo, rating, review count, distance, price tier, category) for display on Directorist listing pages.

* **When data is sent:** each time a Directorist single listing page is rendered (front-end view), the plugin sends a request to the Yelp Fusion API with the listing's latitude / longitude, the configured search radius, and the configured category filter. No personally identifiable information about the site visitor is sent.
* **What is sent:** the listing's geographic coordinates, the radius (meters), the Yelp category slug, the result limit, and your Yelp API key in the Authorization header.
* **Where:** `https://api.yelp.com/v3/businesses/search`
* The plugin will only call this service after the site administrator has entered a Yelp Fusion API key in the plugin settings.

Yelp is a third-party service operated by Yelp Inc. By using this plugin, the site operator agrees to the Yelp API Terms of Use and Yelp's Privacy Policy:

* [Yelp Fusion API Terms of Use](https://terms.yelp.com/developers/api_terms)
* [Yelp Privacy Policy](https://terms.yelp.com/privacy/en_us/)

"Yelp" is a trademark of Yelp Inc. This plugin is not affiliated with, endorsed by, or sponsored by Yelp Inc.

== Installation ==

1. Install and activate the [Directorist](https://wordpress.org/plugins/directorist/) plugin from the WordPress plugin directory.
2. Install **Listing Reviews for Directorist with Yelp** from the WordPress plugin directory, or upload the plugin folder to `/wp-content/plugins/`.
3. Activate the plugin through the **Plugins** menu in WordPress.
4. Get a free Yelp Fusion API key at [yelp.com/developers](https://www.yelp.com/developers).
5. Go to **Listings → Listing Reviews** in the WordPress admin and paste your API key.
6. Click **Test connection** to verify the key works.
7. (Optional) Open the **Display** tab to choose grid columns, card details, and the section title.
8. (Optional) Open **Submission Form** to enable a Yelp Category dropdown on Directorist's frontend listing-submission form.

The "Nearby Places" section will now appear on every Directorist single listing page automatically.

== Frequently Asked Questions ==

= Does this plugin work without Directorist? =

No. **Listing Reviews for Directorist with Yelp** is a Directorist add-on. It requires the [Directorist](https://wordpress.org/plugins/directorist/) plugin to be active. WordPress will prompt you to install Directorist when you activate this plugin.

= What's a Yelp Fusion API key and how do I get one? =

The Yelp Fusion API lets developers fetch business data from Yelp. It's free for most use cases. Sign up at [yelp.com/developers](https://www.yelp.com/developers), create an app, and copy the API key into the plugin's Settings → General tab. The plugin will not make any API calls until a key is configured.

= How much does the Yelp Fusion API cost? =

Yelp's free Fusion API tier covers a substantial number of requests per day. See Yelp's [API documentation](https://docs.developer.yelp.com/) for the current rate limits. Most Directorist sites stay well under the free quota; the plugin also memoizes results within a single page request so multiple sidebar/content placements don't double-count.

= Does the plugin send any visitor data to Yelp? =

**No.** Only the listing's coordinates, radius, category, and your API key are sent in the server-to-server request. No visitor IP, cookies, browser fingerprint, or personally identifiable information is transmitted. The Yelp call happens server-side from your WordPress install, not from the visitor's browser.

= Which Directorist directory types does it work with? =

All of them. Restaurants, hotels, real estate, classifieds, services, events, city guides — any Directorist directory type. The 6 built-in categories (Restaurants, Food, Cafés, Bars, Shopping, Hotels) cover the most common cases; per-listing overrides let you switch categories on a listing-by-listing basis.

= Where does the "Nearby Places" section appear on a listing? =

You choose. Open **Settings → Placement** and pick:

* **Bottom of content** — appears below the listing's main content (default). Recommended.
* **Sidebar** — appears inside Directorist's right sidebar (if the theme has one).

= Can I change the look of the cards? =

Yes — in two ways:

1. **Settings → Display** lets you choose columns (1–4), which card details to show (rating, distance, price), the section title, and whether to display a "Powered by Yelp" credit.
2. **Theme overrides** — drop a copy of `templates/nearby-grid.php` into your theme at `wp-content/themes/your-theme/listing-reviews-for-directorist-with-yelp/nearby-grid.php` and edit it freely.

= Can users pick a Yelp category when they submit a listing? =

Yes. Open **Settings → Submission Form** and enable **Show on submission form**. A "Yelp Category" dropdown will appear inside Directorist's frontend listing form, positioned directly under the address / map fields. Submitters can also override the search radius on their listing if you enable **Allow radius override**.

= Why doesn't the section show up on some listings? =

The plugin needs valid coordinates for the listing. If a Directorist listing doesn't have a latitude/longitude set (the `_manual_lat` and `_manual_lng` post-meta keys), the section is silently skipped — there's nothing to search around. Edit the listing and re-save its address through Directorist's map field.

= Does it slow down my site? =

The Yelp call happens server-side during page render. It's a single HTTP request with an 8-second timeout. On a typical hosting setup the call completes in a few hundred milliseconds. If you upgrade to the Pro version, smart caching reduces every repeat visit to a free local lookup instead of a Yelp request.

= Is the plugin GDPR-friendly? =

Yes. No visitor data leaves WordPress. The plugin makes a server-to-server call to Yelp using only the listing's geographic coordinates and your API key — no visitor IP, no cookies, no third-party script in the visitor's browser. Yelp's photo URLs do load from Yelp's CDN on the frontend, similar to any embedded image; consider including Yelp in your privacy policy if that matters for your jurisdiction.

= Can I show this on a non-Directorist page? =

Not in the free version. The free plugin renders specifically on Directorist's `at_biz_dir` single listing pages. The Pro version adds a `[yelp_nearby]` shortcode, a Gutenberg block, an Elementor widget, and a public REST endpoint so you can drop the nearby grid anywhere.

= Is it translation-ready? =

Yes. The plugin ships with a complete `.pot` file under `/languages/`. All UI strings are wrapped with the `listing-reviews-for-directorist-with-yelp` text domain. PRs welcome to add new locale files.

= Is this plugin affiliated with Yelp? =

No. This plugin uses Yelp's publicly documented Fusion API under the Yelp API Terms of Use. It is not affiliated with, endorsed by, or sponsored by Yelp Inc. "Yelp" is a trademark of Yelp Inc.

== Screenshots ==

1. Nearby Yelp businesses on a Directorist single listing — grid view with photos, star ratings, distance, and price.
2. Settings → General. Connect your Yelp Fusion API key and set the default search radius, result limit, and sort order.
3. Settings → Display. Pick view mode, grid columns, card details, theme, and section title.
4. Settings → Placement. Choose "Bottom of content" or "Sidebar" — recommended placement is pre-selected.
5. Settings → Submission Form. Toggle the Yelp Category dropdown on Directorist's listing-submission form (with optional radius override, required flag, and multi-category for Pro users).
6. Yelp category dropdown rendered inside Directorist's frontend listing-submission form, in the Location step under the map / address fields.
7. Per-listing override on the admin edit screen — pick a different Yelp category or search radius for an individual listing.
8. Result-quality filters in the Display panel — min rating, min reviews, open-now, price tiers, allowlist / blocklist, per-category radius, and Custom CSS.

== Changelog ==

= 1.1.0 =
* **Fix:** Several admin checkboxes (frontend filter bar, multi-category, click tracking, cache cron, alert email, allowlist / blocklist, etc.) silently failed to save because the React UI used different key names than the storage layer. The save path is now end-to-end consistent — every toggle persists on first click.
* **New:** Pro-side frontend visitor filter bar (visible above the nearby grid when enabled) with Category, Min rating, Price, Open-now, Sort, and Radius controls. Visitors re-filter Yelp results without a page reload via a debounced REST refetch.
* **New:** Optional "use the visitor's location" mode. With browser permission, Pro pulls Yelp results around the visitor's coordinates instead of the listing's coordinates.
* **New:** Card themes — Yelp (default), Minimal, Magazine, Dark — applied via `data-theme` on the grid root, with Pro SCSS variants.
* **New:** Custom CSS field — saved CSS is injected into `<style id="lrdy-pro-custom-css">` on listing pages.
* **New:** Multi-category Yelp submissions. When enabled, the listing-submission form renders a multi-select; selected slugs are saved as CSV and passed straight to Yelp Fusion's `categories=` parameter so each listing pulls results from multiple categories at once.
* **New:** `Hide from non-admin submitters` toggle — the Yelp fields render only for admins; regular submitters never see them.
* **New:** Slider settings sub-section (only visible when View Mode is Slider). Controls: autoplay on/off + delay, loop, navigation arrows, pagination dots, space between slides, and slides-per-view × 3 breakpoints (Desktop, Tablet, Mobile). The Pro slider template honors every toggle, conditionally emitting the prev / next / pagination DOM nodes.
* **New:** `cron_warm` daily / weekly schedule. When enabled, Pro pre-warms the Yelp cache for every listing that has a Yelp category set, so the first visitor of the day hits a warm cache.
* **New:** Append-UTM gate. UTM parameters are now appended to outbound Yelp links only when `append_utm` is on (previously always on).
* **New:** Per-request settings overrides (`Settings::push_override` / `reset_override`) and a new `POST /yelp-nearby-directorist-pro/v1/refetch` REST endpoint that rebuilds the grid HTML server-side with visitor overrides — the shared infrastructure behind the filter bar and the geolocate flow.
* **New:** `yelp_nbd_template_settings` filter on the renderer and `yelp_nbd_form_settings` filter on the listing-submission form, so Pro can merge its keys (`card_theme`, `frontend_filters`, `geolocate`, `multi_category`, etc.) into the array the templates bind to.
* **Compat:** `YelpClient` now accepts CSV in the `category` arg so multi-category submissions filter correctly against Yelp Fusion.
* **Compat:** Renderer accepts per-request `lat` / `lng` / `category` / `bypass_cache` overrides, used by the refetch endpoint.

= 1.0.0 =
* Initial release.
* Yelp Fusion API integration with server-side calls only (no visitor data sent).
* React-based tabbed settings page: General, Display, Placement, Submission Form, Cache, Operations.
* Grid view with configurable columns (1–4) and card detail toggles.
* 6 Yelp categories (Restaurants, Food, Cafés, Bars, Shopping, Hotels).
* Per-listing category + radius overrides from admin meta box and frontend submission form.
* Sidebar and below-content placement options.
* Themeable template overrides via `wp-content/themes/your-theme/listing-reviews-for-directorist-with-yelp/`.
* Translation-ready, full POT shipped.

== Upgrade Notice ==

= 1.1.0 =
Fixes admin checkbox saving (frontend filter bar, multi-category, click tracking, cron warming, alert email, allow/block lists), and adds a live Pro visitor filter bar, geolocate mode, four card themes, Custom CSS, multi-category listing submissions, admin-only form fields, and a full slider settings sub-section. Safe upgrade — no breaking changes.

= 1.0.0 =
Initial release of the free Directorist + Yelp integration.
