Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save zackkatz/656e70093cc3cc33f33fcd509ffccc8c to your computer and use it in GitHub Desktop.

Select an option

Save zackkatz/656e70093cc3cc33f33fcd509ffccc8c to your computer and use it in GitHub Desktop.
GravityView Calendar - Set start day to be Monday for a specific feed
<?php
/**
* Change the start day to something other than the WordPress settings.
*
* The value must be a number that represents the day of the week.
* Sunday=0, Monday=1, Tuesday=2, etc.
*
* @param array $calendar_options Calendar options
* @param int $form_id Form ID
* @param int $feed_id Calendar feed ID
*/
add_filter( 'gravityview/calendar/options', function( $calendar_options, $form_id, $feed_id ) {
//
// REPLACE 4 WITH THE ID OF YOUR CALENDAR FEED!
//
if( 4 !== $feed_id ) {
return $calendar_options;
}
// Set the calendar week to start on Monday
$calendar_options['firstDay'] = 1;
return $calendar_options;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment