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.

ShortcodeRendersNotes
[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.

AttributeAllowed valuesEffect
makeMake slugPre-filter by make.
modelModel slugPre-filter by model.
price_minNumberLower bound of the price filter (mapped to min_price).
price_maxNumberUpper bound of the price filter (mapped to max_price).
fuelFuel type slugPre-filter by fuel type.
bodyBody type slugPre-filter by body type.
order_byprice, mileage, dateSort field. Combined with order to produce the sort parameter.
orderasc, descSort direction. Default asc.
per_page12, 24, 48, 72, allItems 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]

AttributeAllowed valuesEffect
results_urlAbsolute or relative URLURL 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]

AttributeAllowed valuesEffect
post_idIntegerID of the location post to render. When omitted, the shortcode resolves the location from the current context.

[as24ci_hours_box]

AttributeAllowed valuesEffect
post_idIntegerID of the location post to render. Same fallback behaviour as [as24ci_location_box].

Operational notes

  • The plugin sets the global $as24ci_render_mode to '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_query while their template renders and call wp_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 its action URL 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.php apply to both the CPT archive and [as24ci_archive], but page-as24ci_compare.php and parts/search-filter.php are not loaded via locate_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 paged cleanly through the hosting page. Try ?page=N or update the permalink structure.
  • Compare page is empty. The ids parameter is missing from the URL. Add at least two vehicle IDs (?ids=123,456).