Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmerovingi/a1470b22e9cbc020f5e068b7c5401b27 to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/a1470b22e9cbc020f5e068b7c5401b27 to your computer and use it in GitHub Desktop.
Add a custom scratch card template from your theme.
/**
* Add Custom Scratch Card Template
* @since 1.0
* @version 1.0
*/
function mycred_add_custom_scratch_card_template( $templates ) {
$templates['mytemplate'] = array(
'label' => 'My Custom Template',
'minimum_scratch' => 75,
'brush_diameter' => 15,
'card_width' => 300,
'card_height' => 400,
'coin_image' => get_template_directory_uri() . '/images/card/coin.png',
'cover_image' => get_template_directory_uri() . '/images/card/cover-image.png',
'buy_log' => '', // optional
'win_log' => '', // optional
'win_message' => '', // optional
'setup' => array(
array(
'number' => 100,
'value' => 0,
'attachment_ids' => array(
get_template_directory_uri() . '/images/card/nowin.png'
)
),
array(
'number' => 10,
'value' => 10,
'attachment_ids' => array(
get_template_directory_uri() . '/images/card/10points.png'
)
)
)
);
return $templates;
}
add_filter( 'mycred_scratch_card_templates', 'mycred_add_custom_scratch_card_template' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment