acf_loop::get_i
This function will return a valid array index for the given $i
Method of the class: acf_loop{}
No Hooks.
Returns
(int).
Usage
$acf_loop = new acf_loop(); $acf_loop->get_i( $i );
- $i
- .
Changelog
| Since 5.3.2 | Introduced. |
acf_loop::get_i() acf loop::get i code ACF 6.8.8
function get_i( $i = 0 ) {
// 'active'
if ( $i === 'active' ) {
$i = -1;
}
// 'previous'
if ( $i === 'previous' ) {
$i = -2;
}
// allow negative to look at end of loops
if ( $i < 0 ) {
$i = count( $this->loops ) + $i;
}
// return
return $i;
}