Codex / mycred/game / Shortcodes / mycred_scratch_cards


This shortcode allows your users to buy and play scratch cards via the Scratch Card add-on.

Requires the Scratch Cards add-on to be installed and enabled.

Available since version 1.0

Shortcode Attributes

Attribute Type Required Default Description
user_id int No current Option to filter purchase history based on user. By default it will show purchases made by the current user viewing the shortcode.
set int Yes - The Card Set ID to run in this shortcode.
theme string No gold Color theme to use. Available values are: plain, inverse, blue, green, gold, red and purple
show_balance int No 1 Option to show a users current balance in the play field. Use 1 to show or zero to hide.
padding int No 20 Option to set a padding for the play field in pixels.
bgcolor string No #f1f1f1 Play field background color.

CSS Styling

// Playfield wrapper
.mycred-scratch-card-playfield { }

// Card Box
.mycred-scratch-card-playfield > div { }

// Notice when a card is purchased or no win
.mycred-scratch-card-playfield > .scratch-notice { }

// Notice when a card win
.mycred-scratch-card-playfield > .scratch-notice div { }

// Card Set Logo (if used)
.mycred-scratch-card-playfield > div img { }


Example 1: Show play field for card set with the ID of 1. Use default sizes and colors.

[mycred_scratch_cards set="1"]

Example 2: Show the play field for card set with the ID of 1 and use a black background.

[mycred_scratch_cards set="1" bgcolor="black"]

Last edited June 23, 2016