Documentation · Troubleshooting
Shortcode Issues
This document covers problems that can occur when using the plugin's shortcodes to embed vehicle listings on WordPress pages or posts.
When to use this document
Read this document when:
- A shortcode renders as plain text (the shortcode tag is visible on the page instead of the expected output).
- A shortcode outputs nothing or blank space.
- The vehicle grid renders but filtering, sorting or pagination does not work correctly.
- The search filter shortcode submits to the wrong page or does not navigate to results.
- CSS or JavaScript required by the shortcode is not loading on the page.
- A shortcode works in one context (e.g. a standard page) but not another (e.g. a widget or a custom template).
Overview
The plugin registers six shortcodes. The three below are the listing/embed shortcodes covered in detail by this document:
| Shortcode | Purpose |
|---|---|
[as24ci_archive] | Renders the full vehicle listing grid with filters, sorting and pagination. |
[as24ci_compare] | Renders the vehicle comparison view. |
[as24ci_search_filter] | Renders the search filter form only, without results. Intended for use on a homepage or landing page to direct visitors to a results page. |
The plugin also registers [as24ci_favorites] (the saved-vehicles / wishlist page), [as24ci_location_box] and [as24ci_hours_box] (location and opening-hours cards). The placement and "shortcode shows as plain text" guidance in this document applies to all of them.
Shortcodes must be placed in the post content field of a WordPress page or post. They are processed by the standard WordPress shortcode API. They are not supported in widgets, template files, PHP code or contexts where do_shortcode() is not called.
Available shortcodes and their attributes
[as24ci_archive]
Renders the vehicle archive with optional pre-filtering.
Supported attributes (all optional):
| Attribute | Values | Description |
|---|---|---|
make | Slug string | Pre-filter by vehicle make. |
model | Slug string | Pre-filter by vehicle model. |
price_min | Integer | Minimum price filter. |
price_max | Integer | Maximum price filter. |
fuel | Slug string | Pre-filter by fuel type. |
body | Slug string | Pre-filter by body type. |
order_by | price, mileage, date | Sort field. Default: date. |
order | asc, desc | Sort direction. Default: asc. |
per_page | 12, 24, 48, 72, all | Results per page. Default: 24. |
GET parameters in the URL override shortcode attributes. This means interactive filtering (the filter form submitting to the same page) works correctly even when shortcode attributes provide defaults.
Example:
[as24ci_archive make="volkswagen" order_by="price" order="asc" per_page="24"]
[as24ci_compare]
Renders the vehicle comparison view. No attributes are defined in the plugin code. The comparison vehicle set is managed by the visitor's browser session (cookies or local storage — verify this behavior in the current plugin version before publishing).
Example:
[as24ci_compare]
[as24ci_search_filter]
Renders a standalone search filter form without listing results. The form redirects to a results page when submitted.
Supported attributes:
| Attribute | Values | Description |
|---|---|---|
results_url | URL | The page where results are displayed. Defaults to the CPT archive URL (/cars/). |
Example:
[as24ci_search_filter results_url="/inventory/"]
If results_url is omitted, the plugin attempts to resolve the CPT archive URL automatically. If the CPT archive URL cannot be determined (for example when using plain permalinks), it falls back to /cars/.
Prerequisites
- The page containing the shortcode must be published and accessible.
- For
[as24ci_archive]: at least one published vehicle post must exist. - Permalinks must not be set to "Plain" for pagination and clean URL routing to function correctly.
Diagnostic steps
Step 1: Confirm the shortcode is in the post content
Shortcodes are only processed when they are placed in the standard post content area (the post_content field). They are not processed in:
- Widget areas (text widgets, custom HTML widgets)
- Custom fields, unless
do_shortcode()is explicitly called on those fields - Theme template PHP files, unless
do_shortcode()is called - Page builder elements that process content independently of
the_contentfilter
If the shortcode appears as plain text ([as24ci_archive] visible on the page), confirm it is in the post body and not inside a custom field or code block that escapes HTML.
Step 2: Confirm the shortcode tag is spelled correctly
Shortcode names are case-sensitive. The correct names are:
as24ci_archiveas24ci_compareas24ci_search_filter
A misspelled shortcode name will output nothing. Check for typos, extra spaces inside the brackets, or incorrect characters.
Step 3: Check that the plugin is active
Shortcodes are registered when the plugin is loaded. If the plugin is deactivated or has a fatal error on load, the shortcode will not be registered and will either output its tag as plain text or nothing at all.
- Go to Plugins → Installed Plugins and confirm ADP Car Market Hub is active and has no error indicator.
- Go to Tools → Site Health and look for any critical issues.
Step 4: Verify CSS and JavaScript are loading
The plugin enqueues its CSS and JavaScript for pages that contain the [as24ci_archive] or [as24ci_compare] shortcodes. It detects this by calling has_shortcode() against the current page's post_content.
If assets are not loading:
- Confirm the shortcode is directly in
$post->post_content. If the content is assembled by a page builder that stores content differently (outside ofpost_content),has_shortcode()may return false and assets will not be enqueued. - If using a page builder, use its shortcode block or HTML block to embed the shortcode in a way that it becomes part of
post_content. - Check the browser developer tools for JavaScript errors that might prevent the filter form or gallery from initialising.
Step 5: Check the results_url attribute for [as24ci_search_filter]
If the search filter form submits to the wrong page or returns a 404:
- Verify the
results_urlattribute points to the correct page where[as24ci_archive]is embedded (or the CPT archive URL). - If no
results_urlis provided, the plugin usesget_post_type_archive_link('as24ci_car'). If this returns nothing (which can happen with plain permalinks), it falls back to/cars/. Ensure the target page exists at that URL. - When using a regular WordPress page as the results page (not the CPT archive), use the page's permalink as
results_url.
Step 6: Investigate pagination with shortcode-embedded archives
On a page using [as24ci_archive], pagination uses ?paged= (or ?page=) query parameters:
- Clicking page 2 should append
?paged=2to the page URL. - If the page redirects to remove query parameters (some themes or caching plugins do this), pagination will break.
- Confirm the permalink structure is not "Plain" (plain permalinks prevent proper pagination routing).
- Exclude the shortcode page from page caching, or configure the cache to vary by
pagedand filter query parameters.
Step 7: Verify pre-filtering with shortcode attributes
If the [as24ci_archive] shortcode uses attributes to pre-filter results (e.g. make="bmw") but the filter is not applied:
- Confirm the attribute value matches the actual slug of a taxonomy term. Slugs are typically lowercase with hyphens instead of spaces (e.g.
mercedes-benznotMercedes-Benz). - Remember that GET parameters override shortcode attributes. If the visitor navigates to the page without any URL parameters, the shortcode defaults apply. If the URL contains filter parameters, those take precedence.
- Confirm that the relevant filter is enabled in the plugin's filter settings. Disabled filters are ignored for GET-parameter-driven filtering, but shortcode attribute overrides bypass the enabled-filters check and apply regardless.
Operational notes
- The
[as24ci_archive]shortcode creates its ownWP_Queryand temporarily replaces the global$wp_query. It restores the original query after rendering. If other plugins or the theme read$wp_queryduring the shortcode render context, they may see unexpected values. - Multiple shortcodes on the same page are supported in principle, but placing two
[as24ci_archive]shortcodes on the same page is not a recommended configuration and may produce unexpected behavior with pagination and filter state. - Shortcodes must not be nested inside each other.
- The
[as24ci_search_filter]shortcode renders only the filter form HTML. It does not include results and does not perform any database queries for vehicle data at render time. The form action URL and hidden routing fields are set at render time based on theresults_urlattribute or the CPT archive URL.
Troubleshooting
| Symptom | Likely cause | Check |
|---|---|---|
| Shortcode visible as plain text | Plugin not active, or shortcode in non-processed context | Confirm plugin is active; move shortcode to post_content |
| Shortcode outputs nothing | Misspelled shortcode name; no published vehicles | Check spelling; confirm vehicles exist and are published |
| Archive grid renders but CSS is missing | has_shortcode() fails because content is outside post_content | Place shortcode directly in post_content, not in a builder field |
| Filters not working | Filter disabled in settings, or JS not loading | Enable filters in Layout Manager; check browser console for errors |
| Search filter sends to wrong page | results_url attribute missing or incorrect | Set results_url to the page with [as24ci_archive] |
| Pagination broken | Plain permalinks, or cache stripping query params | Switch to non-plain permalinks; configure cache exclusions |
| Pre-filter by make not working | Slug mismatch | Use the exact taxonomy slug, not the display label |