Amelia Booking Shortcode

Below, you’ll find a detailed guide on how to add the Amelia Booking Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Ameliabooking Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Ameliabooking Plugin and the shortcodes it provides:

Plugin Icon
Booking for Appointments and Events Calendar – Amelia

"Amelia Booking for Appointments and Events Calendar is a powerful plugin that simplifies event and appointment scheduling. It offers a user-friendly interface and seamless calendar integration."

★★★★☆ (483) Active Installs: 50000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [ameliasearch]

Amelia Booking [ameliasearch] Shortcode

The ‘ameliasearch’ shortcode from Amelia Booking plugin is designed to streamline the booking process. It provides customizable search parameters like ‘trigger’, ‘show’, ‘category’, ‘service’, ’employee’, ‘location’, and ‘counter’. This shortcode generates a search form for booking services, allowing users to filter results based on their preferences. The form is rendered via ‘booking.inc.php’, returning HTML content.

Shortcode: [ameliasearch]

Parameters

Here is a list of all possible ameliasearch shortcode parameters and attributes:

  • trigger – Defines the event that initiates the shortcode
  • show – Controls the visibility of the shortcode
  • category – Filters the shortcode output by category
  • service – Filters the shortcode output by service
  • employee – Filters the shortcode output by employee
  • location – Filters the shortcode output by location
  • counter – Counts the number of shortcode executions

Examples and Usage

Basic example – A simple usage of the AmeliaSearch shortcode to display a booking form without any specific parameters.

[ameliasearch /]

Advanced examples

Display a booking form with a specific category. This will only show services related to the specified category.

[ameliasearch category='3' /]

Display a booking form with a specific service. This will only show the selected service.

[ameliasearch service='2' /]

Display a booking form with a specific employee. This will only show the services provided by the selected employee.

[ameliasearch employee='1' /]

Display a booking form with a specific location. This will only show the services provided at the selected location.

[ameliasearch location='4' /]

Display a booking form with multiple parameters. This will only show the service provided by the selected employee at the specified location.

[ameliasearch service='2' employee='1' location='4' /]

PHP Function Code

In case you have difficulties debugging what causing issues with [ameliasearch] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('ameliasearch', array('AmeliaBooking\Infrastructure\WP\ShortcodeService\SearchShortcodeService', 'shortcodeHandler'));

Shortcode PHP function:

function shortcodeHandler($atts)
    {
        $atts = shortcode_atts(
            [
                'trigger'  => '',
                'show'     => '',
                'category' => null,
                'service'  => null,
                'employee' => null,
                'location' => null,
                'counter'  => self::$counter
            ],
            $atts
        );

        self::prepareScriptsAndStyles();

        ob_start();
        include AMELIA_PATH . '/view/frontend/booking.inc.php';
        $html = ob_get_contents();
        ob_end_clean();

        return $html;
    }

Code file location:

ameliabooking/ameliabooking/ameliabooking.php

Conclusion

Now that you’ve learned how to embed the Ameliabooking Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *