The Entity Posts shortcode displays blog posts linked to Sports Leagues entities (teams, players, games, tournaments). Posts are connected via the “SL Entity Links” metabox on the post edit screen.
Basic Usage
[sl-entity-posts id="123"]
Replace 123 with the ID of your entity (team, player, game, or tournament).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
id | int | (required) | Entity ID (team, player, game, or tournament) |
limit | int | 10 | Maximum posts to display (server max: 100) |
layout | string | grid | Display style: grid or simple |
min_width | int | auto | Minimum card width in pixels: 150, 200, 250, 300, 350, 400 |
Parameter Details
id (required)
- The post ID of the entity you want to show linked posts for
- Find entity IDs in the admin edit screen URL or use SL Selector
- Example: Edit a team, URL shows
post=42means team ID is42
limit
- Controls maximum number of posts shown
- Default: 10 posts
- Server-enforced maximum: 100
layout
grid– Card layout with thumbnail, title, and date (default)simple– Text-only links, more compact
min_width
- Sets minimum width for grid items
- Column count auto-adjusts based on container width
- Valid values: 150, 200, 250, 300, 350, 400
- If omitted: 350px for grid layout, 200px for simple layout
Examples
Display Posts for a Team
[sl-entity-posts id="42"]
Shows up to 10 posts linked to team ID 42.
Limit to 6 Posts
[sl-entity-posts id="42" limit="6"]
Show All Linked Posts
[sl-entity-posts id="42" limit="100"]
Displays up to 100 posts (server maximum).
Simple Text Layout
[sl-entity-posts id="42" layout="simple"]
Compact text links without thumbnails.
Wide Cards
[sl-entity-posts id="42" min_width="400"]
Larger cards for featured content presentation.
Compact List
[sl-entity-posts id="42" layout="simple" min_width="150"]
Very compact text list with narrow columns.
Full Featured Example
[sl-entity-posts id="42" limit="8" layout="grid" min_width="300"]
8 posts, grid layout, 300px minimum card width.
Layout Comparison
Grid Layout
[sl-entity-posts id="42" layout="grid"]
- Featured image thumbnail
- Post title
- Publication date
- Card-based presentation
- Default min-width: 350px
- Best for: Visual blogs, news sites, content-rich pages
Simple Layout
[sl-entity-posts id="42" layout="simple"]
- Text links only
- No thumbnails
- Compact display
- Default min-width: 200px
- Best for: Sidebars, dense information, mobile-first designs
Fluid Grid Behavior
The shortcode uses CSS Grid with auto-fit, meaning columns automatically adjust based on available width:
| Container Width | 350px min (grid) | 200px min (simple) |
|---|---|---|
| 400px | 1 column | 1-2 columns |
| 700px | 2 columns | 3 columns |
| 1050px | 3 columns | 5 columns |
| 1400px | 4 columns | 7 columns |
Template Override
The shortcode template can be overridden in your theme:
- Copy
templates/shortcode-premium-entity-posts.phpfrom the premium plugin - Paste to
yourtheme/anwp-sports-leagues/shortcode-premium-entity-posts.php - Modify as needed
Troubleshooting
Shortcode Displays as Text
In Gutenberg:
- Add a Shortcode block first
- Paste the shortcode inside the block
In Classic Editor:
- Switch to Text mode (not Visual)
- Paste the shortcode
No Posts Appear
- Check the entity ID – Verify it exists and is published
- Check post status – Linked posts must be published, not draft
- Verify linking – Check the “SL Entity Links” metabox on the posts
- Check post types – By default, only
posttype is included
Widget Areas Do Not Work
Some themes and widgets do not process shortcodes. Solutions:
- Use a widget that explicitly supports shortcodes
- Use the
do_shortcode()function in custom code - Consider Layout Builder integration instead
Developer Notes
Filter: Modify Posts Before Rendering
add_filter( 'sports-leagues/shortcode/entity_posts/posts', function( $posts, $data ) {
// Filter or reorder posts
return $posts;
}, 10, 2 );
Filter: Include Additional Post Types
add_filter( 'sports-leagues/entity_posts/allowed_post_types', function( $types ) {
return array_merge( $types, [ 'news', 'article' ] );
});
Filter: Force Specific Grid Width
add_filter( 'sports-leagues/shortcode/entity_posts/min_width_class', function( $class, $data ) {
return 'anwp-grid-min-250'; // Always use 250px
}, 10, 2 );

