Skip to content

Instantly share code, notes, and snippets.

@grantalltodavid
Last active August 10, 2018 19:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantalltodavid/9d20f16e7dee92d166bb25347bc7ff74 to your computer and use it in GitHub Desktop.
Save grantalltodavid/9d20f16e7dee92d166bb25347bc7ff74 to your computer and use it in GitHub Desktop.
Sliced Invoices: add additional options to Payment Reminder Days settings
add_filter( 'sliced_email_option_fields', 'sliced_email_option_fields_add_reminder_days' );
function sliced_email_option_fields_add_reminder_days( $array ) {
if ( ! isset( $array['fields'] ) ) { return $array; }
foreach ( $array['fields'] as $i => $field ) {
if ( isset( $field['id'] ) && $field['id'] === 'payment_reminder_days' ) {
// add to beginning of options list:
$array['fields'][$i]['options'] = array_replace( array(
'-60' => '60 days before Due Date',
'-30' => '30 days before Due Date', //etc...
), $array['fields'][$i]['options'] );
// add to end of options list:
$array['fields'][$i]['options'] = array_replace( $array['fields'][$i]['options'], array(
'+60' => '60 days after Due Date', //etc...
) );
break;
}
}
return $array;
}
@grantalltodavid
Copy link
Author

Note: updated array_merge() with array_replace(), but you'll need PHP >= 5.3 to use this

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