Skip to content

Instantly share code, notes, and snippets.

@xnau
Last active June 8, 2018 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xnau/88a8afb4123d1dd1334de2b7d6cc0df6 to your computer and use it in GitHub Desktop.
Save xnau/88a8afb4123d1dd1334de2b7d6cc0df6 to your computer and use it in GitHub Desktop.
shows how to change the display of a Participants Database field
<?php
/**
* Plugin Name: PDB Customize Currency Display
* Description: replaces a zero value with a custom string
*/
add_filter( 'pdb-before_display_form_element', 'xnau_show_currency_value', 10, 2 );
/**
* replaces a 0 value with a string
*
* @param string $display the display string
* @param object $field the field object
*
* @return string the string to display
*/
function xnau_show_currency_value( $display, $field )
{
if ( $field->name === 'my_currency_field_name' ) {
if ( intval( $field->value ) === 0 ) {
$display = 'Call';
}
}
return $display;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment