Phaser 3 Games in WordPress Posts & Pages
The world of online gaming has evolved exponentially over the years, and with it, the need for game developers to showcase their skills has become more crucial than ever.
Many developers turn to Phaser 3, a fast and versatile JavaScript game development framework, to craft captivating games for the web. However, presenting these games effectively on their WordPress-based portfolios can be very challenging. This is where pwp, our “Phaser 3 to WordPress” prototype, comes to the rescue.
pwp is a WordPress Plugin illustrating how to incorporate a basic Phaser 3 game into WordPress posts and pages using a simple shortcode, for instance:
pwp is freely available on our GitHub.
The Plugin in Action
This Phaser 3 game provided below is a simple 2D platformer – based on Richard Davey’s Tutorial on Making a Game with Phaser 3 – where a player-controlled sprite moves across the screen in response to keyboard inputs (arrow keys).
The Plugin detects if a post or page contains the [pwp] shortcode, and if it does, it enqueues the required scripts – jQuery, Phaser 3, and the game script – and sets up a div element with the necessary attributes for embedding the game.