🎯 Need Help?

Get Premium Support

Priority assistance from the developer

More from ANWP

Football Leagues Premium

Complete football/soccer league management for WordPress

Learn more →

Live Search Shortcode

Pro Feature

Add a live search widget for teams and players with instant Ajax-powered results.

[sl-search]

Overview

The Live Search shortcode creates an Ajax-powered search box that displays instant results as users type. Results appear in a dropdown or inline format, showing matching teams and players with their images.

Parameters

ParameterDefaultDescription
suggestedComma-separated list of player and team IDs to show as suggestions when the input has fewer than 3 characters or no results are found
searchallSearch scope: all (teams and players), teams, or players
layoutdropdownDisplay style: dropdown or inline
mobile_icon_only1Show only the search icon on mobile devices: 1 (yes) or 0 (no)
has_search_icon1Show the search icon: 1 (yes) or 0 (no)
has_reset_icon1Show the reset (X) icon: 1 (yes) or 0 (no)
width250Search input field width in pixels

Layout Options

Dropdown Layout

Best for headers and sidebars. Results appear in a dropdown below the search box. On mobile devices, displays as an icon only by default and expands to a full search field when tapped.

[sl-search layout="dropdown"]

Inline Layout

Best for dedicated search pages. Results display inline below the search box with a full-width presentation.

[sl-search layout="inline" width="400"]

Suggested Items

The suggested parameter lets you display popular teams and players when:

  • The user clicks on the search field (before typing)
  • The user has typed fewer than 3 characters
  • No search results are found

This helps guide users to frequently searched items and improves the search experience.

[sl-search suggested="42,156,78,201"]

Tip

Find team and player IDs by editing them in the admin area. The ID appears in the browser URL (e.g., post=42).

Mobile Behavior

By default, the dropdown layout shows only a search icon on mobile devices to save space. When tapped, it expands to show the full search input.

To always show the full search input on mobile, set mobile_icon_only="0":

[sl-search mobile_icon_only="0"]

Examples

Header Search (Default)

A compact search for your site header with icon-only mobile display:

[sl-search]

Teams-Only Search

Limit search results to teams only:

[sl-search search="teams" width="300"]

Players-Only Search

Limit search results to players only:

[sl-search search="players" width="280"]

Full Search Page

A wider inline search with suggested popular items for a dedicated search page:

[sl-search layout="inline" search="all" suggested="42,156,78,201" width="400"]

Minimal Search

A simple search without the reset icon:

[sl-search has_reset_icon="0" width="200"]

Theme Integration

The reset (X) icon appears only when the user starts typing. Some themes with complex header layouts may need CSS adjustments for proper mobile display.

If the mobile search does not display correctly in your theme header, you can disable the reset icon as a workaround:

[sl-search has_reset_icon="0"]

Note

For complex theme customizations, contact your theme developer or our support team for CSS assistance.

Related