Advertisement
brook-tribe

Set Default Calendar Month

Jul 24th, 2014
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. // UPDATED SNIPPET FOUND HERE: https://gist.github.com/elimn/d034dfddb9be206d9cc1
  2.  
  3. /*
  4.  * Set the default month for the main month calendar view
  5.  */
  6.  
  7. add_filter('tribe_get_month_view_date', 'tribe_events_calendar_default_month');
  8.  
  9. function tribe_events_calendar_default_month ($month) {
  10.     // Month you want cal to default to, example '10' would be October
  11.     $def_month_num = '10';
  12.  
  13.     if ( empty( $_REQUEST['tribe-bar-date'] ) ) {
  14.         $month = date('Y') . "-$def_month_num-01";
  15.     }
  16.  
  17.     return $month;
  18. }
  19.  
  20. /*
  21.  * Set the default month for the mini cal widget
  22.  */
  23.  
  24. add_filter('tribe_events_get_mini_calendar_args', 'tribe_events_mini_calendar_def_month');
  25.  
  26. function tribe_events_mini_calendar_def_month ($args) {
  27.     // Month you want cal to default to, example '10' would be October
  28.     $month_num = '10';
  29.  
  30.     $args['eventDate'] = date('Y') . "-$month_num-01 00:00:00";
  31.     return $args;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement