# Vieww Directory Plugin v1.3.0

Self-contained WordPress plugin for business member directories.
No ACF, no Elementor Pro, no external dependencies required.

---

## Installation

1. Upload the `vieww-directory` folder to `/wp-content/plugins/`
2. Activate via WordPress → Plugins
3. Add members via **Directory** in the admin sidebar
4. Manage business categories via **Directory → Categories** (supports sub-categories)

---

## Shortcodes

### `[viewwdi_sidebar]`
Hierarchical category list — links filter the directory via URL param.

| Attribute | Default | Description |
|-----------|---------|-------------|
| title | "Browse by Category" | Sidebar heading |
| show_counts | true | Show member count per category |
| show_all | true | Show "All Members" link at top |

```
[viewwdi_sidebar]
[viewwdi_sidebar title="Business Types" show_counts="false"]
```

---

### `[viewwdi_directory]`
The member grid. Reads `?member_cat` and `?member_search` from the URL automatically.

| Attribute | Default | Description |
|-----------|---------|-------------|
| columns | 3 | Grid columns (2 or 3) |
| limit | -1 | Max members to show (-1 = all) |
| featured | false | Show only featured members |
| show_search | true | Show search bar above grid |

```
[viewwdi_directory]
[viewwdi_directory columns="2" show_search="false"]
```

---

### `[viewwdi_featured limit="6" columns="3"]`
Quick shortcode for a featured members block (homepage etc.)

---

## Recommended Page Layout (30/70 sidebar)

Use this in an Elementor template or a page with a two-column section:

**Left column (30%)**
```
[viewwdi_sidebar]
```

**Right column (70%)**
```
[viewwdi_directory]
```

The sidebar links update the URL (`?member_cat=retail`) and the directory
reads the URL param to filter — no JavaScript required for the filtering itself.

### Example CSS for two-column layout (add to theme or Elementor custom CSS):
```css
.directory-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.directory-sidebar {
    width: 30%;
    flex-shrink: 0;
    position: sticky;
    top: 100px;   /* adjust to match your header height */
}

.directory-main {
    flex: 1;
    min-width: 0;
}

@media (max-width: 768px) {
    .directory-layout { flex-direction: column; }
    .directory-sidebar { width: 100%; position: static; }
}
```

Then wrap your shortcodes:
```html
<div class="directory-layout">
  <div class="directory-sidebar">[viewwdi_sidebar]</div>
  <div class="directory-main">[viewwdi_directory]</div>
</div>
```

---

## Member Fields

**Business Details:** Name, Tagline, Description, Address (Street, Suburb, State, Postcode)
**Contact:** Phone, Email, Website
**Social Media:** Facebook, Instagram, LinkedIn, YouTube
**Logo:** Media uploader — square, min 400×400px
**Photo Gallery:** Multiple images, media uploader
**Featured toggle:** Pins to top, adds gold badge

---

## Subcategories

Go to **Directory → Categories**, add a parent category (e.g. "Food & Beverage"),
then add child categories (e.g. "Cafes", "Restaurants", "Bakeries") with the parent set.

The sidebar renders parent → children with an expand/collapse arrow.

---

## Customising Colours & Design

Go to **Directory → Design Settings** in the WordPress admin to customise colours,
typography, and spacing. All buttons, active states, and accents update automatically.

CSS custom properties are available for advanced theming:
- `--viewwdi-primary` — primary brand colour
- `--viewwdi-primary-dk` — darker variant
- `--viewwdi-accent` — accent/highlight colour
- `--viewwdi-border` — border colour
- `--viewwdi-bg-soft` — soft background
- `--viewwdi-text` — text colour
- `--viewwdi-muted` — muted/secondary text
- `--viewwdi-radius` — border radius

---

## WooCommerce Events (Stallholder Sales)

No custom code needed. In WooCommerce:
1. Create a product category: "Stall Spaces" (or "Events")
2. Add each event as a **Simple Product** → check **Virtual**
3. Set stock quantity = number of stalls available
4. Standard WooCommerce checkout handles payment

For different stall sizes/prices at the same event, use a **Variable Product**
with variations (e.g. 3×3m / 6×3m) each with their own price and stock.

---

## Changelog

### v1.3.0 — Rebrand to Vieww Directory
- Rebranded from **Next Point Directory** to **Vieww Directory**
- All shortcodes renamed: `np_sidebar` → `viewwdi_sidebar`, `np_directory` → `viewwdi_directory`, `np_featured` → `viewwdi_featured`
- CSS custom properties renamed: `--cd-*` → `--viewwdi-*`
- Meta keys renamed: `_cd_*` → `_viewwdi_*`
- Post type renamed: `np_member` → `viewwdi_member`
- Taxonomy renamed: `member_category` → `viewwdi_category`
- Options renamed: `cd_*` → `viewwdi_*`
- Added automatic database migration — upgrading from old plugin naming (np_/cd_ or vd_) triggers a one-time migration. Fresh installs are unaffected.
- Added **Design Settings** admin page for visual colour/typography customisation (replaces manual CSS editing)
- Added `_viewwdi_featured` backfill on upgrade to prevent members from disappearing in sorted queries

### v1.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

---

Vieww Directory — Built by Vieww
