Documentation · Frontend Guide
Location and Opening Hours
This document covers the location and opening hours feature of the ADP Car Market Hub WordPress Plugin: how dealer locations are displayed on vehicle detail pages, how shortcodes can embed location data elsewhere, and how the feature is configured.
When to use this document
Read this document if you are setting up locations for the first time, adding opening hours to the vehicle detail page, or using the location and hours shortcodes on other pages.
Overview
The plugin includes a Locations feature that stores dealer or branch location data (address, phone, Google Maps location, and opening hours) alongside one or more AutoScout24 seller IDs. When a vehicle's seller ID matches a configured location, the plugin automatically displays the corresponding location address box and opening hours box after the contact form on the vehicle detail page.
The same information can also be rendered on any WordPress page using dedicated shortcodes.
Requirements or prerequisites
- At least one location must be configured in the plugin admin (plugin settings → Locations tab).
- Each location must have at least one seller ID associated with it that matches the
_as24ci_seller_idpost meta value stored on vehicle posts. - For location and hours to appear automatically on vehicle detail pages, the plugin must be active and the vehicle's seller ID must be set.
Step-by-step instructions
Configure a location
- In the WordPress admin, open the plugin settings and navigate to the Locations tab.
- Click Add Location or edit an existing one.
- Fill in the location details: - Name: The dealer name or branch name. - Street: Street address. - ZIP code: Postal code. - City: City name. - Phone: Contact phone number. - Google Maps Location: Optional Google Maps URL for a "Plan route" button. Automatically generated from the location name and address when empty. You can also paste a custom Google Maps URL. - Seller IDs: One or more AutoScout24 seller IDs that are associated with this location. - Opening hours: One or more categories, each with rows of day range and time range pairs.
- Save the location.
Once saved, the location's address and hours will automatically appear on the detail page of any vehicle whose seller ID matches one of the configured seller IDs for that location.
Embed location information on any page using shortcodes
- Open the WordPress page or post where you want to display location information.
- Add one of the following shortcodes in the content editor:
Location box (address, phone, plan-route button):
[as24ci_location_box post_id="123"]Opening hours box:
[as24ci_hours_box post_id="123"]
Replace 123 with the WordPress post ID of the vehicle whose associated location you want to display.
- If you omit the
post_idattribute, the shortcode uses the ID of the current post in the loop. This is useful when placing the shortcode inside a vehicle post template.
Configuration reference
Location fields
Each location is stored as an entry in the plugin's locations option (as24ci_locations). The following fields are supported:
| Field | Description |
|---|---|
name | Location or dealer name (shown as the heading in the location box) |
street | Street address |
zip | Postal code |
city | City name |
phone | Phone number (displayed in bold in the location box) |
url | Optional Google Maps location URL used for the "Plan route" button. When empty, a Google Maps search URL is generated automatically from the location name and address. |
seller_ids | Array of AutoScout24 seller ID strings associated with this location |
hours | Array of opening hours categories (see below) |
Opening hours structure
Opening hours are organized as a list of categories. Each category has a label and one or more rows:
| Field | Description |
|---|---|
category | Category label (e.g., "Sales", "Service", "Parts") |
rows | Array of { days, time } entries (e.g., Mon–Fri, 08:00–18:00) |
Example structure for a single category:
Category: Sales
Row 1: Mon–Fri / 08:00–18:00
Row 2: Sat / 09:00–16:00
Both days and time fields are free-text strings. The plugin does not validate or parse their content.
Shortcodes
| Shortcode | Description |
|---|---|
[as24ci_location_box post_id="…"] | Renders the address box for the vehicle's location |
[as24ci_hours_box post_id="…"] | Renders the opening hours box for the vehicle's location |
Both shortcodes accept a post_id attribute. If omitted, the current post ID in the loop is used. If no matching location is found for the vehicle's seller ID, the shortcode returns empty output.
Operational notes
- Location lookup is performed by matching the vehicle's
_as24ci_seller_idpost meta value against theseller_idsarray of each configured location. The first matching location is used. - The location and hours boxes are rendered after the contact form section via the
as24ci_after_contact_formaction hook. Both boxes are wrapped in a container div (as24ci-location-hours-wrapper). If neither has content, nothing is rendered. - The opening hours box is only rendered when the matched location has at least one non-empty hours category.
- Location data is stored as a serialized array in the WordPress options table with autoload disabled. It is only loaded on vehicle detail pages and in the plugin admin, not on every page request.
- The location box includes a "Plan route" button whenever a Google Maps URL is available — either the
urlfield is set, or it can be auto-generated from the location name and address. No external API calls are made; the auto-generated URL uses the simplehttps://www.google.com/maps/search/?api=1&query=…format. - If a vehicle has no
_as24ci_seller_idmeta value, neither the location box nor the hours box is rendered.
Troubleshooting
The location box does not appear on a vehicle detail page.
- Verify the vehicle has a
_as24ci_seller_idmeta value. This is set during import. Open the vehicle in the WordPress admin and check the vehicle meta fields. - Confirm a location is configured in the plugin settings with a matching seller ID.
- Check that the contact form is visible on the page. The location and hours boxes are rendered after the contact form section via a hook on
as24ci_after_contact_form. If the contact form block is disabled in the Layout Manager, the hook may not fire.
The opening hours box does not appear even though a location is configured.
- Confirm the location has at least one opening hours category with at least one row.
- If the category and rows are present but the box still does not appear, verify the data is being saved correctly in the Locations admin tab.
The shortcode renders empty output.
- Verify the
post_idattribute points to a published vehicle with a valid_as24ci_seller_id. - Confirm there is a location in the plugin settings with a matching seller ID.
- The shortcode returns empty output when no matching location is found or when the vehicle has no seller ID. This is expected behavior.
The "Plan route" button does not appear.
- The button renders whenever the location has a Google Maps URL or enough address data (name, street, ZIP, city) to auto-generate one. If neither is available, fill in the Google Maps Location field or the address fields in the Locations admin tab.