diff --git a/views/page-widgets/parts/monthly-badges.php b/views/page-widgets/parts/monthly-badges.php index 283753078..aa48ce12e 100644 --- a/views/page-widgets/parts/monthly-badges.php +++ b/views/page-widgets/parts/monthly-badges.php @@ -28,8 +28,14 @@ $prpl_total_rows = (int) ceil( $prpl_badges_count / $prpl_badges_per_row ); // We need to know current month badge position. - $prpl_current_month_position = 0; - $prpl_current_month_found = false; + $prpl_current_month_position = 1; + + foreach ( $prpl_badges as $prpl_badge ) { + $prpl_current_month_position++; + if ( 'monthly-' . gmdate( 'Y' ) . '-m' . (int) gmdate( 'm' ) === $prpl_badge->get_id() ) { + break; + } + } $prpl_scroll_to_row = (int) ceil( $prpl_current_month_position / $prpl_badges_per_row ); @@ -57,14 +63,6 @@