Skip to content

Instantly share code, notes, and snippets.

@ChrisFlannagan
Last active October 6, 2017 00:53
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 ChrisFlannagan/36e235224bb135019424fc1eed2504db to your computer and use it in GitHub Desktop.
Save ChrisFlannagan/36e235224bb135019424fc1eed2504db to your computer and use it in GitHub Desktop.
<?php
/**
* @param $value
* @param $option_value
*/
function my_special_field( $value, $option_value ) {
?>
<tr>
<th scope="row" class="titledesc" colspan="2">
<input type="text" name="my_special_field" value="<?php esc_attr( give_get_option( 'my_special_field' ); ?>" />
</th>
</tr>
<?php
}
add_action( 'give_admin_field_my_special_field', 'my_special_field', 10, 5 );
/**
* Save the field
*/
function save_my_special_field() {
if ( ! isset( $_POST['my_special_field'] ) ) {
return;
}
give_update_option( 'my_special_field', sanitize_text_field( $_POST['my_special_field'] ) );
}
add_action( 'give-settings_save_gateways', 'save_my_special_field' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment