Skip to content

Instantly share code, notes, and snippets.

@NateWr
Created April 10, 2019 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NateWr/3728ac8af1a915e2016690645bbbc804 to your computer and use it in GitHub Desktop.
Save NateWr/3728ac8af1a915e2016690645bbbc804 to your computer and use it in GitHub Desktop.
Add separate template tags for the date and time of the booking request.
<?php
/**
* Plugin Name: Date and Time Template Tags for Restaurant Reservations
* Plugin URI: http://themeofthecrop.com
* Description: Add separate template tags for the date and time of the booking request.
* Version: 0.0.1
* 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
*
* 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_notification_template_tags', rtb_add_email_template_tag( $template_tags, $notification ) {
$date = mysql2date( get_option( 'date_format' ), $notification->booking->date );
$time = mysql2date( get_option( 'time_format' ), $notification->booking->date );
$template_tags['{booking-date}'] = apply_filters( 'get_the_date', $date );
$template_tags['{booking-time}'] = apply_filters( 'get_the_time', $time );
return $template_tags;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment