Make day-view/ month-view standard (settings)

Issue #15 resolved
johannesmutter created an issue

Can you add an option to the settings page where one can set a default view for the calendar?

In "class-wc-appointments-admin-calendar.php" line 19:

if($calendar_default = 'day'){
$view           = isset( $_REQUEST['view'] ) && $_REQUEST['view'] == 'month' ? 'month' : 'day';
}else {
$view           = isset( $_REQUEST['view'] ) && $_REQUEST['view'] == 'day' ? 'day' : 'month';
}

Thanks a lot!

Comments (3)

  1. johannesmutter reporter

    Could you add the following code to the Documentation (e.g. something like "Hooks")

    in functions.php
    
    if ( class_exists( 'WC_Appointments' ) ) {
        // Default Calendar view: 'day' or 'month'
        function appointments_default_view() {
            $default_view = 'day';
            return $default_view;
        }
        add_filter( 'woocommerce_appointments_calendar_view', 'appointments_default_view' );
    }
    
  2. Log in to comment