Yacht Listings Shortcode

The Yacht Listings plugin now supports a shortcode-based integration, allowing listings to be displayed anywhere on a page, post, or template while retaining full filtering, pagination, and search functionality.

Basic Usage

Use the shortcode below to display yacht listings:

[yacht-listings]

This will render:

  • Full filter panel
  • Paginated yacht listings
  • Search functionality

Display Listings Anywhere

The shortcode can be placed in:

  • Page content
  • Posts
  • Elementor / Gutenberg shortcode blocks
  • PHP templates (via do_shortcode())

Example:

<?php
echo do_shortcode('[yacht-listings]');
?>

Preset Filters via Shortcode Attributes

You can now pre-filter listings on page load using shortcode attributes.

Supported Attributes

Attribute Description Example Values
type Sail or Power category Power, Sail
fuel Fuel type diesel, unleaded
condition Boat condition Used

Note: Multiple values must be comma-separated.

Examples

Show only Power boats

[yacht-listings type="Power"]

Show Diesel-powered boats

[yacht-listings fuel="diesel"]

Combine multiple filters

[yacht-listings type="Power" fuel="diesel" condition="Used"]

Multiple values per filter

[yacht-listings fuel="diesel,unleaded"]

How Preset Filters Work

  • Preset filters are automatically applied on page load.
  • Matching filter checkboxes are pre-selected.
  • Results are filtered without requiring the Search button.
  • Invalid or unavailable values are safely ignored.
  • Manual search interactions continue to work normally.

URL Parameters vs Shortcode Attributes

If both are present:

  • URL parameters take priority.
  • Shortcode attributes act as defaults only.

Example:

[yacht-listings type="Power"]
?page_no=2&type[]=Sail

In this case, results will follow the URL-based filters (the sail listings will show).

Backward Compatibility

This feature:

  • Does not break existing pages based on old version of the plugin.
  • Does not alter existing search behavior set using old version of the plugin.
  • Works seamlessly with pagination and filtering logic.

Existing implementations will continue to function unchanged.

Notes & Best Practices

  • Attribute values must match system codes exactly as shown in above mentioned table.
  • Values are case-sensitive.
  • Use comma separation for multiple values.
  • Avoid extra spaces unless part of the actual value.

Changelog Reference

This feature was introduced in:
v1.5.4 – Shortcode support & preset filters