[memb_directory]

Description

Renders a directory of members from a Directory post (CPT torii_directory). The directory post is selected by id or slug; its configuration (display mode, items per page, fields, search visibility, card style) provides defaults that shortcode attributes can override.

Access rules on the directory post are enforced: users who can't view the directory see the access-denied output instead.

Map mode (display="map" or the directory's configured mode) renders a lightweight container plus inline JSON config; markers are fetched client-side from an AJAX endpoint, keeping pages cache-safe. Tile provider, zoom, and marker limits come from directory/map settings. Supports Leaflet or MapLibre renderers.

Grid/list mode supports server-rendered search (?dir_search=), pagination (?dir_page=), and sorting (?dir_sort=: name_asc|name_desc|newest|oldest|random).

The HTML this shortcode renders comes from a template you can override in your theme. See Shortcode Templates.

Screens

Grid mode with search and pagination:

A grid directory: member cards in a responsive grid with a search box above

List mode, one member per row:

A list directory: members in compact rows under a column header

Map mode fetches markers client-side; the page HTML stays cache-safe:

A map directory: member markers on a street map with zoom controls and a layer switcher

See Directory Display Modes for the full set of modes and card styles, and Directory Maps for map configuration.

Shortcode Examples

[memb_directory id="123"]

By slug, forcing list display:

[memb_directory slug="coaches" display="list"]

Map with a custom card style:

[memb_directory id="123" display="map" style="compact"]

Shortcode Parameters

id

Directory post ID. Either id or slug must resolve to a published directory. Default: 0.

slug

URL slug of the directory post (an alternative to id). Default: ''.

display

Display mode: grid, list, or map. When empty, the directory's configured mode is used (falling back to grid). Default: ''.

per_page

Members per page in grid/list mode. When 0, the directory's configured value is used. Default: 0.

sort

Default sort order: one of name_asc, name_desc, newest, oldest, random. Overridden by ?dir_sort= in the URL. Default: name_asc.

style

Card style slug (must be one of the registered card styles). When empty or invalid, the directory's configured style is used. Default: ''.

Shortcode Attributes

Attribute Value
Conditional No
Nestable No
Accepts formatting No

Hooks

wpal/torii/directory/before_render and after_render (actions, directory ID) wrap the whole output; card_html (filter) replaces a member card's HTML; card_classes (filter) adjusts card CSS classes; field_value (filter) adjusts individual displayed values; and map/classes, map/popup/before, and map/popup/after customize the map view. Each card template also fires member_card/before and member_card/after (actions, user ID, directory ID).