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/6d290c86f1235f1123a731f7dd8264ea to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/6d290c86f1235f1123a731f7dd8264ea to your computer and use it in GitHub Desktop.
Add a custom scratch card template from your plugin.
/**
* 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' => plugins_url( 'images/card/coin.png', __FILE__ ),
'cover_image' => plugins_url( 'images/card/cover-image.png', __FILE__ ),
'buy_log' => '', // optional
'win_log' => '', // optional
'win_message' => '', // optional
'setup' => array(
array(
'number' => 100,
'value' => 0,
'attachment_ids' => array(
plugins_url( '/images/card/nowin.png', __FILE__ )
)
),
array(
'number' => 10,
'value' => 10,
'attachment_ids' => array(
plugins_url( '/images/card/10points.png', __FILE__ )
)
)
)
);
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