Candy Cane Conundrum

Web Game Integration Guide v1.0.0

Quick Start

A two-phase web game for santasfunnight.com that drives engagement and offers rewards:

  1. Phase 1: Trivia - 5 questions about Santa's Wonderland Nights website
  2. Phase 2: Santa Says - Progressive memory game (Simon Says style)

Players who reach Round 10 can enter their email to receive a $5 discount code.

Download Production Files (ZIP)

Contains: candy-cane-web-v1.0.0.html + backend-example.php

Embedding the Game

Option 1: iframe (Recommended) Easy

Upload candy-cane-web-v1.0.0.html to your media library or theme folder, then embed:

<iframe
  src="/wp-content/uploads/candy-cane-web-v1.0.0.html"
  width="100%"
  height="700"
  frameborder="0"
  style="max-width: 540px; margin: 0 auto; display: block;">
</iframe>
Why this works best: Isolates the game's CSS/JS from your theme, preventing style conflicts.
Option 2: WordPress Shortcode Easy

Add to your theme's functions.php:

function candy_cane_game_shortcode() {
    return '<iframe
      src="' . get_template_directory_uri() . '/games/candy-cane-web-v1.0.0.html"
      width="100%"
      height="700"
      frameborder="0"
      style="max-width: 540px; margin: 0 auto; display: block;">
    </iframe>';
}
add_shortcode('candy_cane_game', 'candy_cane_game_shortcode');

Then use [candy_cane_game] in any post or page.

Option 3: Direct HTML Embed May Have Issues

Copy the contents of the HTML file into a Custom HTML block.

Warning: May have CSS conflicts with your theme. Test thoroughly.

Backend Setup (Required for Rewards)

The game needs a REST endpoint to validate gameplay and send discount codes.

What the Backend Does
Function Description
Validate gameplay Checks timing to prevent cheating (can't reach round 10 in <15 seconds)
Prevent duplicates One reward per email address
Generate codes Creates unique coupon codes (SANTA-XXXXXXXX format)
Send email Delivers discount code via wp_mail()
Implementation Steps ~1-2 hours
  1. Add the endpoint code to your theme's functions.php or create a custom plugin (see backend-example.php in the ZIP)
  2. Configure email - WordPress uses wp_mail(). Consider an SMTP plugin for reliable delivery.
  3. Integrate with tickets - The example generates codes but you need to make them work with your ticket/e-commerce system:
    • If WooCommerce: Create actual coupon codes
    • If external ticketing: Set up codes in that system
    • Manual approach: Store codes and verify at checkout
Endpoint URL: /wp-json/santasfunnight/v1/claim-reward
If using a different URL, update CONFIG.API_ENDPOINT in the game's JavaScript.
View Example PHP Code

See backend-example.php in the ZIP file for complete, documented code including:

  • REST API route registration
  • Play token validation
  • Timing/anti-cheat checks
  • Coupon code generation
  • Email sending
  • Optional: WooCommerce integration
  • Optional: Admin page to view codes

Optional: Leaderboard

What Would a Leaderboard Add? ~3-4 hours

A leaderboard would show top scores, encouraging competition and repeat plays.

Required changes:

  • New REST endpoints: GET /leaderboard and POST /submit-score
  • Database storage (wp_options or custom table)
  • Frontend: Name input, fetch/display top 10
  • Spam prevention (rate limiting, captcha)

Decision points:

  • Anonymous vs. name-required?
  • How to handle duplicate names?
  • Reset leaderboard daily/weekly/never?
Recommendation: Skip for launch. The email capture already provides engagement data. Leaderboard is "nice to have" that adds scope without significant value for the news segment.

Optional: Social Sharing

The Viral Potential ~8-16 hours

Social sharing could make this game go viral with people everywhere playing and telling others about it.

Current state: Players can download a certificate PNG and manually share it.

What "proper" social sharing would require:

Platform Requirements
Facebook Open Graph meta tags, Facebook App ID, share dialog integration
Twitter/X Twitter Cards meta tags, intent URL with pre-filled text
Instagram No direct sharing API - users download and post manually

The bigger picture:

We could create a mini arcade with simplified versions of various games - a "preview" of the event that builds anticipation. But there's a balance: we don't want to give away all our magic before people come.

Considerations:
  • Too much online could reduce in-person excitement
  • Games should tease, not replace the experience
  • Could save full social integration for post-event "share your experience"
Recommendation: Keep manual download/share for now. If this takes off organically, we can add proper sharing later. The certificate already includes the website URL.

Testing Checklist

Before Going Live
  • Open the game directly in browser - does it load?
  • Complete trivia (get 4/5 correct) - does it advance?
  • Play Santa Says - do sounds work on mobile?
  • Reach round 10 (use dev version for testing)
  • Email form shows appropriate error without backend
  • Certificate downloads as PNG
  • Works in WordPress iframe
  • No console errors
  • Test on mobile (touch targets, scrolling)

Files Included

File Purpose
candy-cane-web-v1.0.0.html Production game - embed this one
candy-cane-web-dev.html Development version with cheat modes for testing (not in ZIP)
backend-example.php WordPress REST API endpoint example
README.md Technical documentation
INTEGRATION-GUIDE.html This file

Questions?

Contact Zach or Brett - we can quickly clarify any integration questions.

If Brett gives Zach WordPress access, he can implement the backend himself - would take about an hour.