Skip to main content

Image Sizes

SportsPress registers predefined image sizes on plugin activation. These sizes are available throughout all templates, shortcodes, and custom themes or plugins that use SportsPress data.

Updated today

Image Sizes

SportsPress registers predefined image sizes on plugin activation. These sizes are available throughout all templates, shortcodes, and custom themes or plugins that use SportsPress data.

The sizes are registered in sportspress.php using add_image_size(). Three use aspect-ratio-preserving scaling (false crop parameter — the longest edge is the constraint), and one uses hard cropping for square thumbnails.

Registered Sizes

Size Name

Dimensions

Hard Crop

Use Case

sportspress-fit-medium

300 × 300 px

No

Player photos in profiles; team logos in full-size contexts

sportspress-fit-icon

128 × 128 px

No

Team logos in league tables and event blocks

sportspress-fit-mini

32 × 32 px

No

Small inline icon appearances

sportspress-crop-medium

300 × 300 px

Yes

Gallery thumbnails requiring a square crop

The sportspress-fit-* sizes preserve the original aspect ratio: an image that is wider than it is tall will scale so its width equals the size value, with the height proportionally smaller.

Using the Sizes in Templates

Pass the size name as the $size argument to any WordPress image function:

// Display team logo at icon size
echo get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' );// Display player photo at medium size
echo wp_get_attachment_image( $attachment_id, 'sportspress-fit-medium' );

Using the Sizes in Shortcodes

Some SportsPress shortcodes accept a size parameter that maps directly to these registered size names:

[player-gallery size="sportspress-fit-icon"]

Regenerating Sizes

If images were uploaded before the plugin was activated, WordPress will not have generated the registered size variants. Use the "Regenerate Thumbnails" plugin (or equivalent) to batch-process existing uploads and create the missing size variants.


Sizes verified against source: includes/sportspress/sportspress.php

Did this answer your question?