benecaster_guest_manager_guest_directory_data
Filters one page of the guest list, as the public guest directory (/guests/), each show’s own directory and the benecaster_guests shortcode draw it. The array holds show_id (the show whose guests are listed: a show’s directory, the Show filter on /guests/ or the shortcode’s show; 0 for every show, -1 for nobody), show_filter (the Show select’s choices on /guests/, each { show_id, name, slug, selected }; [] elsewhere and with fewer than two shows on), search, page, pages, total, guests (this page’s, each { guest_id, name, title_line, photo_url, url }: title_line is Title, Organization or whichever is set, photo_url the thumbnail or '', url the guest’s page), previous_url and next_url ('' at either end) and form ({ action, hidden }, the search form’s address and the hidden fields plain permalinks need).
Values are raw; the template escapes them. Keys a callback leaves out keep their values.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$directory |
array |
— | `show_id`, `show_filter`, `search`, `page`, `pages`, `total`, `guests`, `previous_url`, `next_url`, `form` |
Returns:
array
Example
// Put guests with a photo first on each page, keeping A–Z within each group.
add_filter( 'benecaster_guest_manager_guest_directory_data', function ( array $directory ): array {
usort( $directory['guests'], fn( array $a, array $b ): int => ( '' === $a['photo_url'] ) <=> ( '' === $b['photo_url'] ) ?: strcasecmp( $a['name'], $b['name'] ) );
return $directory;
} );
Notes
A return that is not an array is ignored. Walkthrough: Switch on, restyle or extend the public guest directory.
Affects
- Guest directory
Need this built rather than just documented? See our services →