PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.13
Booktics – Appointment Booking Calendar for Service Businesses v1.0.13
1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 All 27 releases
booktics / core / shortcode / service-shortcode.php

service-shortcode.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.13, at core/shortcode/service-shortcode.php

58 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Booktics\Shortcode;
4
5 /**
6 * Service View shortcode class
7 */
8 class Service_Shortcode {
9 /**
10 * Constructor for service view shortcode
11 *
12 * @return void
13 */
14 public function __construct() {
15 add_shortcode(
16 'booktics_service_view', array(
17 $this,
18 'render_service_view',
19 )
20 );
21 }
22
23 /**
24 * Render service view
25 *
26 * @param array $attributes
27 *
28 * @return string
29 */
30 public function render_service_view( $attributes ) {
31 $id = isset( $attributes['id'] ) ? $attributes['id'] : '';
32
33 wp_enqueue_style( 'booktics-vendor' );
34 wp_enqueue_style( 'booktics-frontend' );
35
36 wp_enqueue_script( 'booktics-packages' );
37 wp_enqueue_script( 'booktics-frontend-scripts' );
38 wp_enqueue_script( 'booktics-flatpickr-scripts' );
39
40 do_action( 'booktics_before_rendering_service_view_shortcode' );
41
42 $post = get_post( $id );
43 if ( ! $post || ( isset( $post->post_status ) && $post->post_status === 'deactive' ) ) {
44 return '<div class="booktics-shortcode-notice-wrapper">
45 <div>
46 <h3>' . esc_html__( 'Service Unavailable', 'booktics' ) . '</h3>
47 </div>
48 </div>';
49 }
50
51 return "<div class='booktics-shortcode-wrapper'>
52 <div class='booktics-single-service-wrapper'
53 data-id='" . esc_attr( $id ) . "'>
54 </div>
55 </div>";
56 }
57 }
58