🎯 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 →

Entity Posts Shortcode

Pro Feature

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

ParameterTypeDefaultDescription
idint(required)Entity ID (team, player, game, or tournament)
limitint10Maximum posts to display (server max: 100)
layoutstringgridDisplay style: grid or simple
min_widthintautoMinimum 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=42 means team ID is 42

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 Width350px min (grid)200px min (simple)
400px1 column1-2 columns
700px2 columns3 columns
1050px3 columns5 columns
1400px4 columns7 columns

Template Override

The shortcode template can be overridden in your theme:

  1. Copy templates/shortcode-premium-entity-posts.php from the premium plugin
  2. Paste to yourtheme/anwp-sports-leagues/shortcode-premium-entity-posts.php
  3. 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

  1. Check the entity ID – Verify it exists and is published
  2. Check post status – Linked posts must be published, not draft
  3. Verify linking – Check the “SL Entity Links” metabox on the posts
  4. Check post types – By default, only post type 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 );