Restyle, extend or override a guest’s public page
Each guest has a public page at /guests/{slug}/, or /?benecaster_guest_page={slug} under plain permalinks, {slug} being the guest’s slug. It is the profile_url that benecaster_guest_manager_get_episode_guests() returns.
- Routing. The guest is the page’s main query:
is_singular( 'benecaster_guest' )is true on it, the document title is the guest’s name, and an unknown or unpublished slug is WordPress’s own 404.get_permalink()on a guest returns the page. - Templates, which a theme overrides by copying them to
{theme}/benecaster/guest/:guest/single.php(the theme’s header and footer around the other two; no variables, the guest is the queried object),guest/profile.php($guest_id,$page) andguest/episodes.php($guest_id,$episodes, and$shows: the episodes grouped by show,[{ show_id, name, episodes }]). When the episodes come from more than one show,episodes.phpdraws each show’s cards indiv.benecaster-guest-episodes__showunder anh3.benecaster-guest-episodes__show-name(the show’s name), the show with the guest’s latest appearance first; from one show, one list with no heading. A theme’s copy ofepisodes.phpfrom before this draws one list. The Guest portal’s own form,guest/edit.php, is in Restyle the guest’s own Guest portal form, or act when a guest sends changes. - An override of
episodes.phpmust keep locked episodes locked. Draw each episode with thearchive/episode-cardtemplate part and passcan_accessfrom benecaster_user_can_access_episode()( $episode_id, $show_id, get_current_user_id() ), or a locked episode’s content can leak through the guest who appears in it. - benecaster_guest_manager_guest_page_data
( array $page, int $guest_id )filters what the page draws:guest_id,name,title,organization(on its own line after the title),bio(HTML, paragraphs added),photo_url(themediumsize, or''),website,social(a list of{ platform, url }),publications(see Restyle a guest’s publications) andepisodes, a list of{ episode_id, show_id }: the guest’s published episodes on shows where Guest Manager is on, newest first. Values are raw; the templates escape them. Keys a callback leaves out keep their values. After the filter,showsis worked out from theepisodesit leaves (the shows in order of the guest’s latest appearance on each, each show’s episodes newest first), so filteringepisodesis enough to move or drop a show. - benecaster_guest_manager_before_guest_page and benecaster_guest_manager_after_guest_page
( int $guest_id )fire after the theme header and before the theme footer. - Only while Guest Manager is on for at least one show. Switched off on every show,
/guests/{slug}/is a 404. - Markup classes:
benecaster-guest-page,benecaster-guest-profile(__photo,__name,__title,__organization,__bio,__links,__link,__link--website),benecaster-guest-episodes(__empty,__show,__show-name), withbenecaster-episode-listaround the episode cards.
Code
<?php
// Leave trailers off guest pages.
add_filter( 'benecaster_guest_manager_guest_page_data', static function ( array $page ): array {
$page['episodes'] = array_values( array_filter(
$page['episodes'],
static fn( array $e ): bool => 'trailer' !== get_post_meta( $e['episode_id'], '_benecaster_episode_type', true )
) );
return $page;
}, 10, 2 );
Hooks Used
Need this built rather than just documented? See our services →