Skip to main content

Restyle a guest’s publications, or change or remove the affiliate line

Premium Intermediate Guest Manager

A guest’s publications (books, articles, papers and others, entered on the guest editor) are drawn on their guest page after the website and social links, and in the [benecaster_guest] card when it says publications="true" (off by default). Both draw guest/publications.php, which a theme overrides at {theme}/benecaster/guest/publications.php.

  • The template’s variables: $guest_id; $publications, in the podcaster’s order, each { title, url, rel, affiliate, type, year, details }: url is the address to link to (the Outlinks /go/ address while the publication is tracked and Outlinks is running, else the plain address, '' for no link); rel is sponsored nofollow noopener for an affiliate link and noopener noreferrer otherwise; type is book, article, paper or other; year four digits or ''; details the translated type and the year (Book, 2024); $disclosure, the line under the list, '' for none; $context, page or card. Values are raw: escape them.
  • Markup: section.benecaster-guest-publications (--page or --card), a heading (h2 on the page, p in the card) Publications, ul.benecaster-guest-publications__list of li.__item holding a.__title (or span.__title with no link) and span.__details, then p.__disclosure.
  • A theme that overrides guest/profile.php draws them only if it loads the part itself, as the add-on’s own profile.php does after the links: benecaster_get_template_part( 'guest/publications', [ 'guest_id' => $guest_id, 'publications' => $page['publications'], 'disclosure' => $page['publications_disclosure'], 'context' => 'page' ] ).
  • The guest page’s data filter, benecaster_guest_manager_guest_page_data, carries publications; the disclosure is worked out after it from the publications it leaves.
  • benecaster_guest_manager_affiliate_disclosure ( string $text, int $guest_id ) changes the line Some of these links are affiliate links.; return '' to show none.

Code

<?php
add_filter( 'benecaster_guest_manager_affiliate_disclosure', static function ( string $text, int $guest_id ): string {
    return __( 'We may earn a commission from links marked as affiliate links.', 'my-theme' );
}, 10, 2 );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →