https://www.arhantayoga.org/reserve-parking/我在此页面上有一个下拉菜单。在功能下方的2019年6月10日至7月5日(左侧12个停车位)在setect选项中添加了一些左侧停车位。我想剩下12个停车位以使用不同的颜色。
add_filter( 'gplc_remove_choices', '__return_false' );
add_filter( 'gplc_pre_render_choice', 'my_add_how_many_left_message', 10, 5 );
function my_add_how_many_left_message( $choice, $exceeded_limit, $field,
$form, $count ) {
$limit = rgar( $choice, 'limit' );
$how_many_left = max( $limit - $count, 0 );
$message = "($how_many_left Parking left)";
$choice['text'] = $choice['text'] . " $message";`
return $choice;
}