WooCommerce预订扩展程序具有以下功能:在日历标签中添加一些文字:
<?php
$booking_form_params = array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'i18n_date_unavailable' => __( 'This date is unavailable', 'woocommerce-bookings' ),
'i18n_date_fully_booked' => __( 'This date is fully booked and unavailable', 'woocommerce-bookings' ),
'i18n_date_partially_booked' => __( 'This date is partially booked - but bookings still remain', 'woocommerce-bookings' ),
'i18n_date_available' => __( 'This date is available', 'woocommerce-bookings' ),
'i18n_start_date' => __( 'Choose a Start Date', 'woocommerce-bookings' ),
'i18n_end_date' => __( 'Choose an End Date', 'woocommerce-bookings' ),
'i18n_dates' => __( 'Dates', 'woocommerce-bookings' ),
'i18n_choose_options' => __( 'Please select the options for your booking above first', 'woocommerce-bookings' ),
);
wp_localize_script( 'wc-bookings-booking-form', 'booking_form_params', apply_filters( 'booking_form_params', $booking_form_params ) );
?>
我想修改开始日期和结束日期,但我不确定如何添加这些过滤器。任何帮助表示赞赏。
答案 0 :(得分:0)
我想出来了。万一它可以帮助任何人...
add_filter( 'booking_form_params', 'checkin_checkout' );
function checkin_checkout( $labels ) {
foreach ( $labels as $key => $label ) {
if ( $key == 'i18n_start_date' ) {
$labels[$key] = 'Please choose a check-in date';
}
if ( $key == 'i18n_end_date' ) {
$labels[$key] = 'Please choose a check-out date';
}
}
return $labels;
}