# booktics/1.0.21/core/shortcode/service-shortcode.php

Booktics – Appointment Booking Calendar for Service Businesses, version 1.0.21. 58 lines.

- Page: https://pluginprobe.com/plugins/booktics/1.0.21/code/core/shortcode/service-shortcode.php
- Raw: https://pluginprobe.com/plugins/booktics/1.0.21/raw/core/shortcode/service-shortcode.php
- Modified: 2026-05-20T13:51:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/booktics/1.0.21/code/core/shortcode/service-shortcode.php#L10-L20`.

```php
<?php

namespace Booktics\Shortcode;

/**
 * Service View shortcode class
 */
class Service_Shortcode {
    /**
     * Constructor for service view shortcode
     *
     * @return  void
     */
    public function __construct() {
        add_shortcode(
            'booktics_service_view', array(
                $this,
                'render_service_view',
            )
        );
    }

    /**
     * Render service view
     *
     * @param array $attributes
     *
     * @return  string
     */
    public function render_service_view( $attributes ) {
        $id = isset( $attributes['id'] ) ? absint( $attributes['id'] ) : 0;

        wp_enqueue_style( 'booktics-vendor' );
        wp_enqueue_style( 'booktics-frontend' );

        wp_enqueue_script( 'booktics-packages' );
        wp_enqueue_script( 'booktics-frontend-scripts' );
        wp_enqueue_script( 'booktics-flatpickr-scripts' ); 

        do_action( 'booktics_before_rendering_service_view_shortcode' );

        $post = get_post( $id );
        if ( ! $post || ( isset( $post->post_status ) && $post->post_status === 'deactive' ) ) {
            return '<div class="booktics-shortcode-notice-wrapper">
                    <div>
                        <h3>' . esc_html__( 'Service Unavailable', 'booktics' ) . '</h3>
                    </div>
                </div>';
        }

        return "<div class='booktics-shortcode-wrapper'>
                        <div class='booktics-single-service-wrapper'
                             data-id='" . esc_attr( $id ) . "'>
                        </div>
                    </div>";
    }
}

```
