• Apologies if this is the wrong forum. I have developed a game that is played on an HTML canvas with custom JavaScript to handle player interaction with objects on the canvas. Question: Is WordPress appropriate for developing a site to publish this game?

    I am obviously new to WordPress but from what little I have seen it does seem to constrain the user to set themes, plugins, etc. So, before trying to learn it more, it would be good to know if it’s amenable to my final goal of publishing an HTML canvas game. Thank you.

    Added: To be a bit more specific: I would need a freehand on the game page itself to place the canvas, buttons etc., controlled with my own JavaScript.

    • This topic was modified 3 years, 4 months ago by chicksaw.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, if this is pure html and js this is for sure possible.

    You have multiple options on how to do it. You could just put your code into an html block or you could make a shortcode.

    Making a shortcode would probably be the prettier version and it is just as easy as just putting it into an html block

    Thread Starter chicksaw

    (@chicksaw)

    Thank you, Benni. Just to confirm then: I can create in my WordPress site a page with HTML elements like canvas, buttons, etc. controlled by my own JS and CSS, via an “html block” or “shortcode”.

    I don’t as yet know what these two are as I have just started to look into WordPress, but I am sure I can learn. If you could kindly confirm the above then I will make a commitment to WordPress. Thanks again.

    Moderator bcworkz

    (@bcworkz)

    You can use a custom HTML block to insert exactly that, HTML that isn’t easily composed by using any of the standard blocks. However, do not insert <script> blocks here. Script syntax will likely get mangled if you do.

    You can insert <script> blocks via shortcode or a custom block you’ve developed. <script> isn’t the preferred way to introduce scripts. It’s fine for brief snippets that may relate to specific content, but to introduce general script code onto a page, it’s best enqueued as an external file.

    If you have very elaborate HTML you need on a page, you might be better off creating a custom page template for the page. It needn’t utilize editor content at all if you prefer. The editor would mainly be to establish a permalink to the page, the template would manage all page content. From templates, you can freely output <script> blocks, but enqueuing is still preferred.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘HTML canvas game in wordpress?’ is closed to new replies.