Contents

Shortcodes and blocks - Plugixa Car Rental

Plugixa Car Rental puts two things on the public side of your site: the booking form, where customers search and book, and the customer portal, where they open and cancel a booking from the link in their email. Each one is available as a block and as a shortcode. They do the same thing, so use whichever suits the way you build pages.

A third shortcode shows the plugin’s admin app on a page of your site, for your staff only. With Pro, a fourth draws your desks on a Google map.

What Block Shortcode
Booking form Car rental booking [plugixa_car_rental_booking]
Customer portal Car rental: manage booking [plugixa_car_rental_account]
Rental desk for staff None [plugixa_car_rental_app]
Map of your desks PRO None [plugixa_car_rental_map]

The booking form

As a block

The block editor with the Car rental booking block selected and its Booking form panel showing the Start at location ID field

  1. Create or open a page, for example “Book a car”.
  2. Click the + inserter and search for “rental” or “booking”.
  3. Choose Car rental booking. Its description reads “The online booking form: search dates, choose a car, book.”
  4. Publish the page.

In the editor the block shows a placeholder, not the live form: “Visitors search dates, choose a car and book here. The live form appears on the published page.” This is on purpose. The live form asks your site for real availability and puts real holds on cars, which you do not want while you are only arranging a page. Open the published page, or use the editor’s preview, to see the form itself.

The block has one setting, in the Booking form panel of the sidebar:

Setting What it does
Start at location ID (optional) The location the search starts on. Leave it empty to start on the first location that takes pickups. The customer can still pick another location in the form.

The block is full width by default, so the row of location, date and time fields has room on a block theme. You can switch it to wide with the block toolbar’s alignment button. On a full-width block the form keeps the theme’s side padding, so it lines up with the rest of the page instead of touching the edges of the screen.

The block is rendered fresh on every visit. Prices and availability are never saved into the page, so a page cache cannot serve an old price.

As a shortcode

Put this on any page, post or widget that runs shortcodes:

[plugixa_car_rental_booking]
Attribute What it does
location The ID of the location the search starts on, for example [plugixa_car_rental_booking location="2"]. An ID that is not a location taking pickups is ignored and the form starts on the first one that is.

A location page per desk is the usual use for this attribute: the “Cascais Marina” page opens the form with Cascais Marina already chosen.

Any link to the page that holds the form can choose the desk too. Add ?pcr_location= and the location’s ID to the page’s address:

https://example.com/book-a-car/?pcr_location=3

The form opens with that desk chosen, as if the customer had picked it. This works in the free edition, with the block and with the shortcode, so you can use it in a menu, a button or an email. Two things to know:

  • A location attribute on the shortcode, or Start at location ID on the block, wins over the link.
  • Only a number is read. An ID that is not a location taking pickups is ignored and the form starts on the first one that is.

The Book here buttons of the Map PRO are links of this kind.

Finding a location’s ID

Open the location in Plugixa Car Rental -> Locations. The number in the address bar, in #/config/locations/<ID>/edit, is its ID. See Locations.

The customer portal

  1. Create a page, for example “Manage your booking”.

  2. Add the Car rental: manage booking block, or this shortcode:

    [plugixa_car_rental_account]
    
  3. Publish the page.

The shortcode has no attributes and the block has no settings. In the editor the block shows a placeholder: “Customers open their booking here from the link in their confirmation email, and can cancel it within your policy.”

Once the page is published, the plugin finds it by itself and starts putting a “View or cancel your booking” link in confirmation emails and a “View or cancel this booking later” link on the last step of the booking form. If you have more than one page carrying the portal, choose the right one under Settings -> Cancellations and customer portal -> Portal page ID. See Customer portal.

Both on one page

A page may carry the booking form and the portal together, or several booking forms. Each one reads its own settings, and the scripts are loaded once.

Colours

The booking form and the customer portal take their colours from Settings -> Booking form style, not from the block. See Booking form style.

When the form does not appear

What you see Why
The shortcode text itself, or nothing, on the page The Booking form app or the Customer portal app is switched off in the App Manager. Switching an app off removes its shortcode and its block.
“Online booking is not open yet. Please contact us.” No active location allows pickups. See Locations.
“Please enable JavaScript to book a car online.” The visitor’s browser has JavaScript switched off. The form needs it.
“We could not reach the booking service. Check your connection and try again.” The form talks to your site through the WordPress REST API, and something (a security plugin, a firewall rule) blocks it for visitors who are not signed in. See Troubleshooting.

The rental desk on a page, for staff

[plugixa_car_rental_app] shows the plugin’s whole admin app, the same one you use in wp-admin, on a page of your site. It is meant for a counter computer or a tablet at the desk, where staff should not need the WordPress dashboard.

Only signed-in users who are allowed to use Plugixa Car Rental in wp-admin see the app. Everybody else, visitors included, sees “Sign in to open the rental desk.” with a sign-in link. What each user can see and do is exactly what they can see and do in wp-admin, because the page uses the same permissions.

Attribute Values What it does
mode embed (default), full embed shows the app inside your page, in a frame, with your theme’s header, menu and footer around it. full replaces the whole page with the app, with none of your theme around it.
width wide (default), full, content For embed only: how wide the frame is. wide and full use your theme’s wide and full alignments; content keeps it to the width of your text column.
height A number of pixels For embed only: the height of the frame. Leave it out to let the plugin choose. Anything under 320 is raised to 320.

For example:

[plugixa_car_rental_app mode="embed" width="full" height="900"]

The app is shown in a frame because no theme’s styles can then change how it looks, and its styles cannot change your theme. There is no block for this shortcode.

The map PRO

[plugixa_car_rental_map]

Shows your desks on a Google map with a searchable list beside it, each with its opening state, its lowest daily price, Book here and Directions. It needs a Google Maps API key and coordinates on each location. Its attributes are height, zoom, layout, style, search and page. See Map. In the free edition the tag is not a shortcode and is printed as plain text.

What to do next

Quick Links