Last active
August 10, 2018 19:26
-
-
Save grantalltodavid/9d20f16e7dee92d166bb25347bc7ff74 to your computer and use it in GitHub Desktop.
Sliced Invoices: add additional options to Payment Reminder Days settings
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
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: updated array_merge() with array_replace(), but you'll need PHP >= 5.3 to use this