( $month != 1 ? $month - 1 : 12 ) , 'yr' => ( $month != 1 ? $year : $year - 1 ) ) ); printf( ' ', $url ); // Next Month - nav $url = add_query_arg( array( 'mo' => ( $month != 12 ? $month + 1 : 1 ) , 'yr' => ( $month != 12 ? $year : $year + 1 ) ) ); printf( ' ', $url ); ?>
0 ) { $running_day = $running_day - 1; array_push($headings, __( 'SUN', 'another-events-calendar' ) ); } else { array_unshift($headings, __( 'SUN', 'another-events-calendar' ) ); } if( $running_day == -1 ) { $running_day = 6; } echo ''; $days_in_month = date( 't', mktime( 0, 0, 0, $month, 1, $year )); $days_in_this_week = 1; $day_counter = 0; echo ''; // Row for week one echo''; // Print "blank" days until the first of the current week for( $i = 0; $i < $running_day; $i++ ) { echo ''; $days_in_this_week++; } // Keep going with days.... for( $list_day = 1; $list_day <= $days_in_month; $list_day++ ) { echo ''; if( $running_day == 6 ) { echo ''; if( ( $day_counter + 1 ) != $days_in_month ) { echo ''; } $running_day = -1; $days_in_this_week = 0; } $days_in_this_week++; $running_day++; $day_counter++; } // Finish the rest of the days in the week if( $days_in_this_week > 1 && $days_in_this_week < 8 ) { for( $i = 1; $i <= ( 8 - $days_in_this_week ); $i++ ) { echo ''; } } // Final row echo ''; ?>
'.implode( '', $headings ).'
'; // Add in the day number echo '
'; echo '

'.$list_day.'

'; echo '

'.$headings[$running_day].'

'; echo '

'.$list_day.'

'; echo '
'; // QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! if MATCHES FOUND, PRINT THEM !! echo '
'; $date = sprintf( '%d-%02d-%02d', $year, $month, $list_day ); if( ! empty( $events[ $date ] ) ) { $meta = array(); foreach( $events[ $date ] as $event ) { $meta[] = ''.$event->post_title.''; } echo implode( '
', $meta ); } else { echo str_repeat( '

 

', 2 ); } echo '
'; echo '