Skip to main content

Player Gallery

The `[player_gallery]` shortcode displays players from a Player List as a photo gallery — a grid of player photos with names as captions.

Updated today

Player Gallery

The [player_gallery] shortcode displays players from a Player List as a photo gallery — a grid of player photos with names as captions.

What It Displays

A responsive grid of player thumbnail photos with player names below each image. Players can be grouped by position, each group with its own heading. Clicking a photo links to the player's page when link_posts is enabled.

When to Use It

Use on any page. Supply id pointing to a SportsPress Player List post. Inside the Loop on a Player List page, id can be omitted.

Parameters

Parameter

Type

Default

Description

id

integer

get_the_ID()

Post ID of the Player List. Required outside the Loop.

title

string/boolean

false

Override the displayed heading.

number

integer

-1

Maximum number of players to display. -1 shows all (or uses the list's own number setting).

grouping

string/null

From list

Group players: 'position' to group by position. Defaults to the Player List's grouping setting.

grouptag

string

'h4'

HTML heading tag for group headings when grouping is active.

orderby

string

'default'

Field to sort players by. 'default' uses the list's sort. 'rand' for random order.

order

string

'ASC'

Sort direction: 'ASC' or 'DESC'.

columns

integer

3

Number of columns in the photo grid.

size

string

'sportspress-crop-medium'

WordPress image size to use for thumbnails.

itemtag

string

'dl'

HTML tag wrapping each gallery item.

icontag

string

'dt'

HTML tag wrapping the image within each item.

captiontag

string

'dd'

HTML tag wrapping the caption within each item.

show_all_players_link

boolean

false

1 to show a "View all players" link below the gallery (requires id).

link_posts

boolean

From settings

1 to link player photos to player pages.

Usage Examples

Minimal — photo gallery for a player list:

[player_gallery id="55"]

4-column gallery, grouped by position, with player links:

[player_gallery id="55" columns="4" grouping="position" link_posts="1"]

Random order gallery with a "View all players" link:

[player_gallery id="55" orderby="rand" show_all_players_link="1"]

Did this answer your question?