Snake is a very popular and most addicting game people used to play mostly on mobile phones. Now you can add it in your WordPress site and allow all your website users including unregistered visitors to play this game on your website. You can add it inside a page, post, custom post type or text widget simply by using its shortcode.
Install and activate Snake plugin in your WordPress site. After activation use [snake] shortcode wherever you want to display this game. You can play this game by pressing the start button, it displays your score there itself. Its default view looks nice, it also provides you Shortcode variables for customized display options:
The shortcode accepts variables, like this:
[snake color=blue]. This would make the color of the snake blue. Here’s an overview of the variables you can use:
color: set the color of the snake. Accepted values are
foodcolor: set the color of the food. Accepted values are any color definitions (
#ff0000for red, e.g.). Default:
timeout: set the timeout for the snake to walk. You need to enter an integer, this will be the timeout in milliseconds. Default:
200. It is highly recommended to keep this value above 100, since slower computers might not be able to handle the game with a low timeout.
[snake color=green foodcolor=red timeout=100]
This would give you a green snake, red food and a timeout of 100 milliseconds.