Last active
June 8, 2018 20:12
-
-
Save xnau/88a8afb4123d1dd1334de2b7d6cc0df6 to your computer and use it in GitHub Desktop.
shows how to change the display of a Participants Database field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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