Skip to content

Instantly share code, notes, and snippets.

@dancameron
Created August 20, 2019 16:10
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 dancameron/686c2588bc3d2836543d8dad2c263280 to your computer and use it in GitHub Desktop.
Save dancameron/686c2588bc3d2836543d8dad2c263280 to your computer and use it in GitHub Desktop.
Override Months and Years for Sprout Invoices
<?php // don't include this line in your functions.php, since it already starts with it.
function _custom_get_month_options() {
$months = array(
'01' => __( '01 - January', 'sprout-invoices' ),
'02' => __( '02 - February', 'sprout-invoices' ),
'03' => __( '03 - March', 'sprout-invoices' ),
'04' => __( '04 - April', 'sprout-invoices' ),
'05' => __( '05 - May', 'sprout-invoices' ),
'06' => __( '06 - June', 'sprout-invoices' ),
'07' => __( '07 - July', 'sprout-invoices' ),
'08' => __( '08 - August', 'sprout-invoices' ),
'09' => __( '09 - September', 'sprout-invoices' ),
'10' => __( '10 - October', 'sprout-invoices' ),
'11' => __( '11 - November', 'sprout-invoices' ),
'12' => __( '12 - December', 'sprout-invoices' ),
);
return $months;
}
add_filter( 'si_payment_month_options', '_custom_get_month_options' );
function _custom_get_year_options( $number = 10 ) {
$this_year = (int) date( 'Y' );
$years = array();
for ( $i = 0 ; $i < $number ; $i++ ) {
$year = substr( $this_year + $i , 2 );
$years[ $year ] = $this_year + $i;
}
return $years;
}
add_filter( 'si_payment_year_options', '_custom_get_year_options' );
@dancameron
Copy link
Author

This snippet is a customization for Sprout Invoices. A customizable solution that provides a way for you to get paid via your WordPress site. For more information please don't hesitate to reach out.

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