Skip to main content

Using Shortcodes

SportsPress shortcodes let you embed fixtures, tables, player stats, and other sports content in any WordPress post, page, or text widget.

Updated today

Using Shortcodes

SportsPress shortcodes let you embed fixtures, tables, player stats, and other sports content in any WordPress post, page, or text widget.

The "S" Button in the Classic Editor

When editing a post or page with the Classic (TinyMCE) editor, SportsPress adds an "S" toolbar button. Clicking it opens a menu of available shortcodes grouped by type (Event, Player, etc.). Selecting one inserts the shortcode tag at the cursor position with a placeholder id attribute that you replace with the correct post ID.

The Shortcodes Panel on Edit Screens

On the edit screen for a Calendar, League Table, Player List, Staff Directory, Tournament, or Event post, SportsPress displays a Shortcodes meta box in the right-hand sidebar. This panel automatically generates the correct shortcode for the current post — including the post ID already filled in — so you can copy it and paste it directly into any page or post without having to look up the ID manually.

The id Parameter

Every shortcode that displays data from a specific SportsPress post (calendar, league table, player list, etc.) accepts an id parameter whose value is the WordPress post ID of that record.

Inside the Loop (on a single event, player, or team page) you can omit id — the template falls back to get_the_ID() automatically.

Outside the Loop (on a standalone page, a text widget, or any page that is not the single post for the item you want to display) the id parameter is required. Without it the shortcode has no post to pull data from and will either output nothing or use a random post ID.

Example — omitting id inside the loop works:

[league_table]

Example — id is required when embedding on a different page:

[league_table id="42"]

You can also pass the post ID as the first positional argument (no key name):

[league_table 42]

Both forms are equivalent.

Finding a Post ID

The fastest way to find a post ID is to hover over the post title in the WordPress admin list view — the URL in the status bar contains post=123, where 123 is the ID. Alternatively, open the post and look at the URL in the browser address bar.

Pasting Shortcodes into Pages and Posts

  1. Copy the shortcode string (e.g. [event_list id="99"]).

  2. Open the page or post where you want the content to appear.

  3. In the Classic editor, paste into the Text tab or use the "S" button. In the Block editor, use a Shortcode block and paste the string inside it.

  4. Save and preview the page.

Note: SportsPress requires WordPress permalinks to be set to at least "Day and name" (anything other than "Plain"). With plain permalinks, scheduled events and calendar navigation do not work correctly.

Did this answer your question?