Documentation · Appendices
Shortcode Reference
This appendix is a quick reference for the shortcodes registered by the ADP Car Market Hub plugin.
When to use this document
Use this reference when you need to look up a shortcode name, its supported attributes or a copy-paste example. For the conceptual explanation of the shortcodes (when to use which one, how they interact with templates), see Shortcodes in the technical documentation and Shortcodes Reference in the frontend guide.
Overview
All shortcodes are registered by the plugin's main bootstrap and are available on every WordPress page or post (subject to the active editor and any block-level restrictions). They return strings rather than echoing, so they can be embedded inside captions, table cells or block patterns.
| Shortcode | Renders | Notes |
|---|---|---|
[as24ci_archive] | The vehicle archive (filterable, sortable, paginated). | URL parameters override shortcode attributes. |
[as24ci_search_filter] | The standalone search-filter form, without results. | Submits to a results URL you choose. |
[as24ci_compare] | The vehicle comparison page. | Vehicles selected via the ids URL parameter. |
[as24ci_favorites] | The visitor's favorites page. | Hydrates from the favorites REST helper; favorites are stored client-side. |
[as24ci_location_box] | A location card for a single location post. | Resolves the location from post_id or context. |
[as24ci_hours_box] | An opening-hours card for a single location post. | Same fallback behaviour as [as24ci_location_box]. |
Attribute reference
[as24ci_archive]
All attributes are optional. URL parameters of the same name override the shortcode attribute, so visitors can refine the results interactively.
| Attribute | Allowed values | Effect |
|---|---|---|
make | Make slug | Pre-filter by make. |
model | Model slug | Pre-filter by model. |
price_min | Number | Lower bound of the price filter (mapped to min_price). |
price_max | Number | Upper bound of the price filter (mapped to max_price). |
fuel | Fuel type slug | Pre-filter by fuel type. |
body | Body type slug | Pre-filter by body type. |
order_by | price, mileage, date | Sort field. Combined with order to produce the sort parameter. |
order | asc, desc | Sort direction. Default asc. |
per_page | 12, 24, 48, 72, all | Items per page. |
Pagination uses ?paged= (preferred) or ?page= from the URL.
Example:
[as24ci_archive make="bmw" price_max="40000" order_by="price" order="asc" per_page="24"]
[as24ci_search_filter]
| Attribute | Allowed values | Effect |
|---|---|---|
results_url | Absolute or relative URL | URL the form submits to. Defaults to the as24ci_car post-type archive URL, falling back to /cars/ when no archive URL is available. |
Only the filters enabled in the Search filters layout zone are rendered. Manage them in the Layout Manager admin tab.
Example:
[as24ci_search_filter results_url="/inventory/"]
[as24ci_compare]
No documented attributes in the current source. Selection is driven by the ids URL parameter, a comma-separated list of vehicle post IDs.
Example URL: /compare/?ids=123,456
[as24ci_favorites]
No documented attributes. The visible fields are configured by the Favorites layout zone in the Layout Manager. Vehicle data is fetched from POST /wp-json/as24ci/v1/favorites for the IDs the visitor has stored locally.
[as24ci_location_box]
| Attribute | Allowed values | Effect |
|---|---|---|
post_id | Integer | ID of the location post to render. When omitted, the shortcode resolves the location from the current context. |
[as24ci_hours_box]
| Attribute | Allowed values | Effect |
|---|---|---|
post_id | Integer | ID of the location post to render. Same fallback behaviour as [as24ci_location_box]. |
Operational notes
- The plugin sets the global
$as24ci_render_modeto'shortcode'while a shortcode template renders. Asset loading and analytics use this flag so shortcode-based pages behave consistently with the native CPT archive. [as24ci_archive]and[as24ci_compare]swap the global$wp_querywhile their template renders and callwp_reset_postdata()afterwards. Embed them in the main content area to avoid interfering with theme components that read the global query early.[as24ci_search_filter]builds itsactionURL from the configured (or default) results URL and preserves any query parameters present in that URL via hidden form fields, so it works with both pretty and plain permalinks.- The bundled archive and search-filter templates always use the plugin's own files. Theme overrides for
archive-as24ci_car.phpapply to both the CPT archive and[as24ci_archive], butpage-as24ci_compare.phpandparts/search-filter.phpare not loaded vialocate_template()and cannot be overridden from a theme without editing the plugin source. Verify against the current plugin version before publishing. - Pages served by a full-page cache should be purged after editing a page that uses these shortcodes so the latest output is served.
Troubleshooting
- Shortcode prints as raw text. Check the shortcode name; names are case-sensitive. Use the lowercase form documented above.
[as24ci_archive]shows the wrong vehicles. The URL likely already carries filter parameters from a previous page; URL parameters always override shortcode attributes.[as24ci_search_filter]shows no fields. No filters are enabled in the Search filters layout zone. Open the Layout Manager and enable the filters you need.[as24ci_favorites]shows an empty list. The visitor has no favorites stored in the current browser. Favorites are scoped to the browser/device.- Pagination links 404. Your permalink structure may not pass
pagedcleanly through the hosting page. Try?page=Nor update the permalink structure. - Compare page is empty. The
idsparameter is missing from the URL. Add at least two vehicle IDs (?ids=123,456).