/** * Print the widget content * @since 0.0.1 */ public function widget($args, $instance) { global $rtb_controller; // Don't show the widget if the form has already been displayed. The // date and time pickers don't yet support multiple forms on a page. if ($rtb_controller->form_rendered === true) { return; } // Print the widget's HTML markup echo $args['before_widget']; if (isset($instance['title'])) { $title = apply_filters('widget_title', $instance['title']); echo $args['before_title'] . $title . $args['after_title']; } echo rtb_print_booking_form(); echo $args['after_widget']; }
/** * Append booking form to a post's $content variable * @since 0.0.1 */ function append_to_content($content) { if (!is_main_query() || !in_the_loop() || post_password_required()) { return $content; } $booking_page = $this->settings->get_setting('booking-page'); if (empty($booking_page)) { return $content; } global $post; if ($post->ID != $this->settings->get_setting('booking-page')) { return $content; } return $content . rtb_print_booking_form(); }
function rtb_booking_form_shortcode() { return rtb_print_booking_form(); }