• Hi ,

    I’m trying to embed flash games from miniclip site in to wordpress, it provides the two parts of embed code

    <!-- Place this code where you'd like the game to appear -->
    <div id="miniclip-game-embed" data-game-name="commando-rush" data-theme="1" data-width="680" data-height="520"></div>
    
    !-- Insert this code before your </body> tag -->				<script src="http://www.miniclip.com/js/game-embed.js"></script>

    does any one has a clue to go about adding this code to site

    thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The first part of the code can be inserted in the body of a page/post using the HTML editor. You can also enter it in a text widget and place it anywhere your theme supports widgets.

    To add the second part of your code, you will need to use a child theme and attach that code to the wp_head action hook in your functions file.

    Thread Starter ehteshamuddin.syed

    (@ehteshamuddinsyed)

    Hi Kjodle,

    Thank you for the reply,

    I have created a child theme but unable to follow your instructions of ” attached that code to wp_head action hook in your functions file”, could you please provide detailed steps on how to do that, I’m fairly new to wordpress.

    Thanks

    Do you already have a functions file? If not, open a text editor and type:

    <?php
    
    add_action ('wp_head', 'insertminiclip' );
    function insertminiclip() {
    	echo "<script src="http://www.miniclip.com/js/game-embed.js"></script>";
    }
    
    ?>

    Yes, it’s that simple. Make sure you don’t include any spaces before the opening <?php tag or after the closing ?> tag, or you’ll get the dreaded “Headers already sent by…” error.

    Be sure to use a real text editor (i.e., Notepad++ or something similar), save the document as functions.php and upload it to your child theme folder.

    Let me know if you have problems.

    Thread Starter ehteshamuddin.syed

    (@ehteshamuddinsyed)

    Hi Kjodle,

    appreciate your reply,

    I added the funtions.php file as you have suggested, now my child theme folder has two files funtions.php and style.css linking to parent theme, I followed the this link to create child theme, also added the top part of the code to post in the HTML segment however the game doesnt seem to appear on the post, could you please look in to it and suggest what could possibly be missing.

    Thank you

    now my child theme folder has two files funtions.php and style.css linking to parent theme

    Yes, that’s correct. A style.css is all that’s really needed; the functions.php is optional.

    I can’t really guess as to why it isn’t working without seeing a link to your site.

    Thread Starter ehteshamuddin.syed

    (@ehteshamuddinsyed)

    I’m still struggling to get it to work, i have not hosted the site yet so cannot share the link if you point me to any direction for further research it will of a great help to me.

    thanks

    Try using your browser’s “View Source” function to see if that code above is actually being added to the <head> element of a page.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘how to embed code from (miniclip) into wordpress site’ is closed to new replies.