As of Cab Grid Pro version 2 the shortcode supports attributes that can adjust the appearance and functionality of each instance of Cab Grid on your website. This article discusses what shortcode attribute are available and how to implement them.
The syntax for attributes is (use double quotes around values):
[cabGridPro attr1="val1" attr2="val2"]
Current Cab Grid Pro Shortcode Attributes
If it is not set, the default layout will be used – as set in the OPTIONS tab of the Cab Grid Pro WordPress admin.
The layout attribute can currently be set to ‘passengers‘ or ‘vehicle‘ or ‘tickets‘ or ‘time‘
When set to ‘passengers‘ the Cab Grid interface will show input boxes for the number of passengers and number of luggage items, and use this information to calculate which vehicle is most appropriate and select a price.
When set to ‘vehicle‘ the Cab Grid interface will display details of all vehicles configured. The user will need to choose a vehicle as well as setting origin and destination to obtain a journey price.
When set to ‘tickets‘ the Cab Grid interface will show a single number input. This is for the number of tickets required. This is good for municipal transport such as bus, coach or train services. The number of tickets specified will multiply the price for the journey. So 2 tickets for a £10 journey will result in a price of £20.00 being displayed. (The number of tickets will govern which vehicle is selected – and hence price table.)
When set to ‘time‘ the Cab Grid interface will show a number input. This is for the number of time units required. The unit of time can be set in the OPTIONS tab when ‘Length of time‘ is selected for the ‘Price Based On’ option. This is good for tour or hire style businesses. The time period specified will multiply the price for the journey. So 2 units (hours, days, or whatever set) for a £10 journey will result in a price of £20.00 being displayed.
In ‘time‘ mode, the number of passengers field will also be displayed (though it is possible to hide this field through CSS). This is used to govern which vehicle is selected – and hence price table. The return button is also hidden in time mode as it is not relevant (though it may be re-enabled through CSS). The time option was introduced in Cab Grid Pro version 4.5.
[cabGridPro layout="passengers"] or
The ‘icons‘ attribute is used to set the general icon set and text colours the instance uses.
Currently, values can be set to ‘light’ or ‘dark’. Light icons (& text) are for instances with dark backgrounds and vice versa.
The ‘luggage‘ attribute is used to set if the luggage input field is hidden.
It expects values of either ‘Off’ (with capital ‘O’) to hide the input field, or ‘On’ (with upper-case ‘O’) to explicitly show the input field*.
These attributes allows you to pre-define (set the drop-down) for either pick up or destination.
Setting the ‘ORIGIN’ attribute to a value that exactly matches one of your place names will pre-define the pickup location drop down for this instance of the Cab Grid Pro plugin.
Setting the ‘DEST’ attribute to a value that exactly matches one of your place names will pre-define the drop-off location drop down for this instance of the Cab Grid Pro plugin.
The values set for ORIGIN and DEST must exactly match (case-sensitive) a place name set in the AREAS tab. The corresponding checkbox under the ‘Origin’ or ‘Destination’ columns in the AREAS tab must also be checked/ticked and the origin/dest entered must also be part of the GROUP.
For PASSENGER and TICKET layout modes, if both ORIGIN and DEST attributes are set and matched, the Cab Grid Pro interface will perform the calculation and return a price. In VEHICLE mode, the visitor must select a vehicle for the calculation to be performed.
Setting only one of either ORIGIN or DEST attributes will simply pre-populate the corresponding drop down and no calculation will be performed. The customer can then go on to select or change options to get a price and book as normal.
[cabGridPro origin="place1" dest="place2"]
The ‘vehicles‘ attribute is used to restrict the vehicles the instance uses for price calculations.
If set, in ‘vehicles’ layout mode, only the identified vehicles will be displayed. In other modes, the price lookup will be restricted to the vehicles identified.
The vehicles attribute expects vehicle ID numbers separated by a comma. The ID of a vehicle can be found by hovering the mouse over the vehicle name field under the VEHICLES tab on the Cab Grid Pro admin page: