I would like

I would like to display on each providers profile page “available” or “occupied” during opening hours. Once the session is over it will change to available. Please advice which appointment hook will get the information if a service provider is booked or not.

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi KunSoren ,

    I’ve made a mu-plugin to help with this that adds a new shortcode that you can use on any page/post you like. You can use it with : [provider_availability id=”1″] , where you can change the ID depending on the provider you want the check to be made for.

    How to install:

    Always make sure to keep a backup of your site before changing/adding custom code.

    1] Navigate to your /wp-content/ directory and create a new one named mu-plugins if it doesn’t exist.

    2] Download the attached .zip and extract it. You will find a file named is_the_provider_occupied.php

    3] Upload the file from the .zip into the mu-plugins directory.

    4] The final path should look like /wp-content/mu-plugins/is_the_provider_occupied.php

    5] Everything should work after that automatically when you add the shortcode as explained above.

    Tell me if this worked for you or if you need any further adjustments !



    Code Preview:


    * Plugin Name: Appointments+ - Provider availability shortcode
    * Plugin URI: https://premium.wpmudev.org/
    * Description: mu-plugin for [provider_availability id="1"] to show if the provider is available/occupied/not working.
    * Version: 1.0.0
    * Author: Konstantinos Xenos @ WPMUDEV
    * Author URI: https://premium.wpmudev.org/
    * License: GPLv2 or later

    if ( ! defined( 'ABSPATH' ) ) {

    function is_the_provider_occupied( $atts ) {

    $a = shortcode_atts(
    'id' => null,

    $content = 'Please specify a provider ID';

    if ( ! empty( $a['id'] ) && class_exists( 'Appointments' ) ) {
    $args = array(
    'worker_id' => $a['id'],

    $start = current_time( 'timestamp' );
    $end = current_time( 'timestamp' );

    $is_working = appointments_is_working( $start, $end, $a['id'], 0 );

    $is_occupied = apppointments_is_range_busy( $start, $end, $args );

    if ( $is_working && $is_occupied ) {
    $content = 'Occupied.';
    } elseif ( $is_working ) {
    $content = 'Available.';
    } else {
    $content = 'Not working.';

    return $content;
    add_shortcode( 'provider_availability', 'is_the_provider_occupied' );

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.