Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function add_open_close_fields( $post_type = 'gd_place' ){
- $weekdays = array( 'sunday' => __( 'Sunday', 'gd_business_hours' ),
- 'monday' => __( 'Monday', 'gd_business_hours' ),
- 'tuesday' => __( 'Tuesday', 'gd_business_hours' ),
- 'wednesday' => __( 'Wednesday', 'gd_business_hours' ),
- 'thursday' => __( 'Thursday', 'gd_business_hours' ),
- 'friday' => __( 'Friday', 'gd_business_hours' ),
- 'saturday' => __( 'Saturday', 'gd_business_hours' ), );
- foreach ( $weekdays as $key => $day ){
- self::add_day_open_field( $day, $post_type );
- self::add_day_close_field( $day, $post_type );
- }
- }
- private static function add_day_open_field( $day, $post_type ){
- $field = array( 'listing_type' => $post_type,
- 'data_type' => 'TIME',
- 'field_type' => 'time',
- 'admin_title' => sprintf( __( '%s opening time', 'gd_business_hours' ), $day ),
- 'admin_desc' => sprintf( __( 'Time location opens on %s', 'gd_business_hours' ), $day ),
- 'site_title' => sprintf( __( '%s opening time', 'gd_business_hours' ), $day ),
- 'htmlvar_name' => strtolower( $day ) . '_open',
- 'default_value' => '',
- 'option_values' => '',
- 'is_default' => '0',
- 'is_admin' => '1',
- 'show_on_listing' => '0',
- 'show_on_detail' => '0',
- 'clabels' => sprintf( __( '%s opening time', 'gd_business_hours' ), $day ), );
- geodir_custom_field_save( $field );
- }
- private static function add_day_close_field( $day, $post_type ){
- $field = array( 'listing_type' => $post_type,
- 'data_type' => 'TIME',
- 'field_type' => 'time',
- 'admin_title' => sprintf( __( '%s closing time', 'gd_business_hours' ), $day ),
- 'admin_desc' => sprintf( __( 'Time location closes on %s', 'gd_business_hours' ), $day ),
- 'site_title' => sprintf( __( '%s closing time', 'gd_business_hours' ), $day ),
- 'htmlvar_name' => strtolower( $day ) . '_close',
- 'default_value' => '',
- 'option_values' => '',
- 'is_default' => '0',
- 'is_admin' => '1',
- 'show_on_listing' => '0',
- 'show_on_detail' => '0',
- 'clabels' => sprintf( __( '%s closing time', 'gd_business_hours' ), $day ), );
- geodir_custom_field_save( $field );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement