=== Vieww Directory ===
Contributors: jarradnpd
Tags: directory, business directory, member directory, listings, business listings
Requires at least: 5.6
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.4.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A simple, beautiful business directory for your WordPress site. Add member profiles with logos, photos, contact details and a map — and let visitors search and browse them by category.

== Description ==

Vieww Directory is the easiest way to put a member directory on your WordPress site. Whether you run an industry association, a local business network, a tradies' directory, a club or a community marketplace, your members get a clean profile page and your visitors find them in seconds.

You add a member, choose a category, drop a shortcode into a page — and that's it. No page builder, no extra plugins, no fuss.

**What your visitors get:**

* A clean, searchable directory of every member
* Filter by category, search by name or keyword
* A profile page for each member with logo, photo gallery, contact details and a map of where to find them
* A featured-members showcase to spotlight your top supporters

**What you get:**

* Add a member in under a minute — name, contact details, photos, done
* Hierarchical categories so you can organise members the way they actually fit
* Featured members get a gold badge and the top of the list
* Pick your own colours, fonts and spacing from a single design panel
* A grid layout that looks great on phones, tablets and desktops
* Built-in maps for member locations (or turn maps off site-wide if you'd rather not use them)

**Shortcodes you can drop into any page or layout:**

* `[viewwdi_directory]` — the full directory grid with search and category filters
* `[viewwdi_layout]` — directory grid with the category sidebar in a two-column layout
* `[viewwdi_featured]` — a row of your featured members
* `[viewwdi_sidebar]` — just the category navigation (works in widget areas too)

**Requirements:**

* WordPress 5.6 or higher
* PHP 7.4 or higher

== Installation ==

1. Upload the `vieww-directory` folder to `/wp-content/plugins/` directory, or install through the WordPress plugins screen
2. Activate the plugin through the 'Plugins' screen in WordPress
3. Add members via **Directory** in the admin sidebar
4. Manage business categories via **Directory > Categories** (supports subcategories)
5. Use shortcodes in your pages to display the directory

== Frequently Asked Questions ==

= Do I need any other plugins? =

No! The plugin is completely self-contained. It registers its own custom post type and creates native WordPress meta boxes for all member fields.

= What shortcodes are available? =

**Directory Grid:**
`[viewwdi_directory]`

Displays all members in a responsive grid with search and category filtering.

Attributes: `columns` (2 or 3, default 3), `limit` (number of members, default -1 for all), `featured` (true/false), `show_search` (true/false).

**Category Sidebar:**
`[viewwdi_sidebar]`

Renders a hierarchical category list. Clicking a category filters the directory.

Attributes: `title` (heading text), `show_counts` (true/false), `show_all` (true/false).

**Featured Members:**
`[viewwdi_featured limit="6" columns="3"]`

Quick shortcode for a featured members block.

**All-in-One Layout:**
`[viewwdi_layout]`

Renders the sidebar and directory grid in a responsive two-column layout. No page builder columns needed.

Attributes: all `[viewwdi_directory]` attributes plus `show_sidebar` (true/false), `sidebar_title` (heading text), `show_counts` (true/false).

= How do I set up a two-column directory page? =

The easiest way is to use `[viewwdi_layout]` — it renders the sidebar and grid side by side automatically.

Alternatively, place `[viewwdi_sidebar]` in a 30% left column and `[viewwdi_directory]` in a 70% right column using your page builder or theme layout. The sidebar links update the URL and the directory reads the URL parameter to filter automatically.

= Can I customise the appearance? =

Yes! Go to **Directory > Design** in the WordPress admin to customise colours, typography, and spacing. Changes apply to all directory pages, cards, and profiles.

= How do featured members work? =

Edit any member and check the "Mark as Featured Member" checkbox in the sidebar. Featured members appear first in the directory with a gold badge.

= Does the plugin support subcategories? =

Yes! Go to **Directory > Categories**, add a parent category (e.g. "Food & Beverage"), then add child categories (e.g. "Cafes", "Restaurants") with the parent set. The sidebar renders parent > children with an expand/collapse arrow.

== Screenshots ==

1. The directory archive — searchable, category sidebar, an interactive map of member locations, and "Featured" cards highlighting key listings.
2. A single member profile — logo, tagline, full About section, contact-details sidebar with phone/email/website/socials, and a location map.

== Changelog ==

= 1.4.2 =
* NEW: WordPress.org listing now ships with screenshots — directory archive and single member profile. Screenshot captions rewritten to match.

= 1.4.1 =
* IMPROVEMENT: Plugin description and listing rewritten to focus on what site owners and visitors get out of the directory, rather than internal architecture.
* NEW: Plugin icon added.

= 1.4.0 =
* IMPROVEMENT: Single-member Location section now renders as a matching teal-headed card alongside Contact Details, instead of a flush, unstyled map below the contact panel.
* IMPROVEMENT: Member cards in the directory grid now align their "View Profile" button to the bottom regardless of contact-detail length, so cards in the same row sit flush.
* IMPROVEMENT: Empty-state copy across the directory archive is more conversational ("No members match your filters" / "Browse all members") with a heading + body + CTA layout.
* FIX: Addresses with both a unit keyword AND a slash (e.g. `Unit 5/123 Main St`) no longer lose the street number during geocoding — the unit-prefix stripper now stops at the slash, so the trailing house number survives and Nominatim resolves to the actual street rather than the suburb centroid.

= 1.3.2 =
* Fix: Business Name was not syncing to the post title/slug in the block editor, leaving new members saved as "No title" with a numeric slug. The sync-to-title JavaScript was registered via wp_add_inline_script() on a hook callback that fired before the target script handle was registered, so the inline code was silently dropped. Bumped the inline-script callback priority so it runs after the main admin enqueue.
* Fix: Hardened the save_post handler's recursion guard against the edge case where an anonymous-closure callback could not be unhooked via remove_action() — now uses a static re-entrancy flag.
* Enhancement: Members saved with a numeric fallback slug (e.g. 9887) now get a proper slug generated from the Business Name on the next save.
* New: Added Directory → Settings admin page with an "Enable maps" toggle. When disabled, Leaflet, MarkerCluster, Nominatim geocoding, Photon address autocomplete, the map container, the admin-side map assets, and the Latitude/Longitude meta-box fields are all suppressed. Default is enabled for backward compatibility. Existing coordinate data is preserved when maps are disabled and restored if re-enabled.

= 1.3.1 =
* Internal release — superseded by 1.3.2.

= 1.3.0 =
* Rebranded from Next Point Directory to Vieww Directory
* All shortcodes renamed: np_sidebar to viewwdi_sidebar, np_directory to viewwdi_directory, np_featured to viewwdi_featured
* Automatic database migration from old plugin naming
* Added Design Settings admin page for visual colour/typography customisation
* Added featured member backfill on upgrade
* Full internationalization support
* WordPress.org coding standards compliance
* Security: proper nonce verification, input sanitisation, and output escaping throughout

= 1.1.0 =
* Initial release (as Next Point Directory)
* Custom post type for directory members with full business detail fields
* Hierarchical business categories with parent/child support
* Three shortcodes: sidebar, directory grid, featured members
* Logo and photo gallery uploads
* Search and category filtering via URL parameters
* Responsive grid layout
* Featured member highlighting with gold badge

== External Services ==

This plugin connects to a small number of free, optional external services. Each is described below along with when it is used and what data is sent.

= Google Fonts API =

Used to load web fonts chosen in the Design Settings. Only occurs when a Google Font (as opposed to a system font) is selected in **Directory > Design > Typography**.

* **URL:** https://fonts.googleapis.com
* **When used:** Only when a Google Font is selected in Design Settings (off by default — system fonts are the default)
* **Data sent:** The names of the selected font families (e.g. "Inter", "Poppins"). No personal data or site data is transmitted.
* **Privacy policy:** https://policies.google.com/privacy
* **Terms of service:** https://developers.google.com/terms

If you prefer not to use Google Fonts, simply leave the heading and body font selectors set to a System Font — no external requests will be made.

= Nominatim (OpenStreetMap) geocoding =

Used to convert a member's address into latitude/longitude coordinates so the listing can be shown on the directory map. Runs on the server when a member is saved in the WordPress admin, and in the browser when an admin clicks the "Geocode Now" button on a member edit screen.

* **URL:** https://nominatim.openstreetmap.org/search
* **When used:** Only on the admin side — when a member is saved with a new/changed address, or when the "Geocode Now" button is pressed in the Business Details meta box. No lookups run on the front-end.
* **Data sent:** The member's street address, suburb, state, postcode, and the country string "Australia". No personal data beyond the business address.
* **Privacy policy:** https://osmfoundation.org/wiki/Privacy_Policy
* **Terms of use:** https://operations.osmfoundation.org/policies/nominatim/

Leaving the latitude/longitude fields filled manually in the member edit screen prevents any Nominatim request from being sent for that member on save.

= Photon (komoot.io) address autocomplete =

Used to show a real-time address suggestion dropdown in the admin while typing into the Street Address field. Selecting a suggestion populates the suburb, state, postcode and coordinates at once.

* **URL:** https://photon.komoot.io/api/
* **When used:** Only on the admin side — while an editor is typing into the Street Address field of a member. Requests stop if the user stops typing or clicks elsewhere. No lookups run on the front-end.
* **Data sent:** The partial address text the user is typing, plus a geographic bias toward Australia. No personal data, no site data.
* **Privacy policy:** https://www.komoot.com/privacy
* **Service info:** https://photon.komoot.io/

If you prefer not to use Photon autocomplete, simply ignore the suggestions and type the address manually — no suggestions will be acted on unless you click or Enter one.

== Upgrade Notice ==

= 1.3.2 =
Critical fix: members saved in the block editor now correctly persist their Business Name as the post title and slug. Also adds a Settings page with an opt-out toggle for map features. Upgrade strongly recommended.

= 1.3.0 =
Rebranded to Vieww Directory with automatic data migration, design customisation, and WordPress.org compliance. All existing data is migrated automatically.

== Support ==

For support, please use the WordPress.org support forums for this plugin.
