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:

ShortcodePurpose
[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):

AttributeValuesDescription
makeSlug stringPre-filter by vehicle make.
modelSlug stringPre-filter by vehicle model.
price_minIntegerMinimum price filter.
price_maxIntegerMaximum price filter.
fuelSlug stringPre-filter by fuel type.
bodySlug stringPre-filter by body type.
order_byprice, mileage, dateSort field. Default: date.
orderasc, descSort direction. Default: asc.
per_page12, 24, 48, 72, allResults 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:

AttributeValuesDescription
results_urlURLThe 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_content filter

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_archive
  • as24ci_compare
  • as24ci_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.

  1. Go to Plugins → Installed Plugins and confirm ADP Car Market Hub is active and has no error indicator.
  2. 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:

  1. Confirm the shortcode is directly in $post->post_content. If the content is assembled by a page builder that stores content differently (outside of post_content), has_shortcode() may return false and assets will not be enqueued.
  2. 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.
  3. 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:

  1. Verify the results_url attribute points to the correct page where [as24ci_archive] is embedded (or the CPT archive URL).
  2. If no results_url is provided, the plugin uses get_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.
  3. 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:

  1. Clicking page 2 should append ?paged=2 to the page URL.
  2. If the page redirects to remove query parameters (some themes or caching plugins do this), pagination will break.
  3. Confirm the permalink structure is not "Plain" (plain permalinks prevent proper pagination routing).
  4. Exclude the shortcode page from page caching, or configure the cache to vary by paged and 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:

  1. Confirm the attribute value matches the actual slug of a taxonomy term. Slugs are typically lowercase with hyphens instead of spaces (e.g. mercedes-benz not Mercedes-Benz).
  2. 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.
  3. 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 own WP_Query and temporarily replaces the global $wp_query. It restores the original query after rendering. If other plugins or the theme read $wp_query during 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 the results_url attribute or the CPT archive URL.

Troubleshooting

SymptomLikely causeCheck
Shortcode visible as plain textPlugin not active, or shortcode in non-processed contextConfirm plugin is active; move shortcode to post_content
Shortcode outputs nothingMisspelled shortcode name; no published vehiclesCheck spelling; confirm vehicles exist and are published
Archive grid renders but CSS is missinghas_shortcode() fails because content is outside post_contentPlace shortcode directly in post_content, not in a builder field
Filters not workingFilter disabled in settings, or JS not loadingEnable filters in Layout Manager; check browser console for errors
Search filter sends to wrong pageresults_url attribute missing or incorrectSet results_url to the page with [as24ci_archive]
Pagination brokenPlain permalinks, or cache stripping query paramsSwitch to non-plain permalinks; configure cache exclusions
Pre-filter by make not workingSlug mismatchUse the exact taxonomy slug, not the display label