Created
November 30, 2018 18:58
-
-
Save jrick1229/773452f00a8b6267d217391ae5df7531 to your computer and use it in GitHub Desktop.
Add a max custom interval: https://gist.github.com/bernattorras/26b2a7e22ad0b772e36f718431a6a781
This file contains hidden or 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 | |
add_filter('woocommerce_subscription_period_interval_strings', 'add_extra_period_intervals', 10, 1); | |
function add_extra_period_intervals($intevals){ | |
$max_intervals = 20; // The maximum number of intervals you want to display | |
$intervals = array( 1 => _x( 'every', 'period interval (eg "$10 _every_ 2 weeks")', 'woocommerce-subscriptions' ) ); | |
foreach ( range( 2, $max_intervals ) as $i ) { | |
$intervals[ $i ] = sprintf( _x( 'every %s', 'period interval with ordinal number (e.g. "every 2nd"', 'woocommerce-subscriptions' ), WC_Subscriptions::append_numeral_suffix( $i ) ); | |
} | |
return $intervals; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment