Jump to content

How to put Phaser game into wordpress site?


ekeimaja
 Share

Recommended Posts

So, I need to put Phaser game to WordPress static site. Theme is called Zerif lite.

I need to put game to big title -section, where is not possible to use widgets.

How can I make the game appear to this section? Where do I put my game folder structure? Or is this even possible to make?

Link to comment
Share on other sites

Hi, 

it's possible to integrate your gmae in WordPress. Check this page on my web site (click on button called "Zoop: Pick them all"). 

You have to:

  1. upload your game folder in a folder on your FTP (i put my games in a folder called "jeux" on WP root folder)
  2. In your WP page, go to "text" (not visual) editor, add a div container for your game.
  3. Then add a script tag at the end of page to start game.
Link to comment
Share on other sites

<div class="home-header-wrap">

<?php

	global $wp_customize;

	echo '<div class="header-content-wrap">';

		echo '<div class="container">';

?>
<script src="<?php echo get_stylesheet_directory_uri(); ?>/game/phaser.js"></script>
<script src="<?php echo get_stylesheet_directory_uri(); ?>/game/boot.js"></script>
<script src="<?php echo get_stylesheet_directory_uri(); ?>/game/preload.js"></script>
<script src="<?php echo get_stylesheet_directory_uri(); ?>/game/game3.js"></script>


<div id="game">

  <script src="<?php echo get_stylesheet_directory_uri(); ?>/game/main.js"></script>

</div>
	
<?php
	echo '</div><!-- .header-content-wrap -->';
		echo '<div class="clear"></div>';

?>

</div>

Now it gives error

SyntaxError: expected expression, got '<'
Phaser.Loader.prototype.fileComplete()             phaser.js:71080
Phaser.Loader.prototype.xhrLoad/xhr.onload()  phaser.js:70672

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...