Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sows how to add a custom summary tag to a Participants Database log
* Plugin Name: PDB Custom Summary Tag
* Description: provides a custom tag to the "cars" log
add_filter( 'pdblog-summary_tags', 'xnau_add_custom_summary_tag', 10, 2 );
* adds a custom summary tag to the "cars" log
* @param array $tags
* @param string $log_name
function xnau_add_custom_summary_tag( $tags, $log_name )
if ( $log_name === 'cars' )
$tags['average_score'] = $tags['sum'] / $tags['count'];
return $tags;
Copy link

xnau commented Feb 26, 2022

This filter adds an [average_score] tag that can be used in the summary template for the selected log.

This assumes that the log sum is configured as the sum of all scores. The tag makes it possible to display the average score in the summary display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment