Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hides the time field in the booking form. Requires PHP 5.3+
<?php
/**
* Plugin Name: Hidden Time Field for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Hides the time field in the booking form. Requires PHP 5.3+
* Version: 1.0
* Author: Theme of the Crop
* Author URI: http://themeofthecrop.com
* License: GNU General Public License v2.0 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Requires at least: 4.0
* Tested up to: 4.01
*
* Text Domain: restaurant-reservations
* Domain Path: /languages/
*
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along with this program; if not, write
* to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if ( ! defined( 'ABSPATH' ) )
exit;
add_filter( 'rtb_booking_form_fields', 'rtbht_hide_time', 10, 2 );
function rtbht_hide_time( $fields, $request ) {
$fields['reservation']['fields']['time']['callback'] = function() {
echo '<input type="hidden" name="rtb-time" value="12:00 PM">';
};
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.