The NewHaze Wordpress Plugin

How to get it and installation

First of all, visit http://wordpress.org/extend/plugins/newhaze/ and press the download button. Once you've downloaded it, upload it from your Wordpress control panel, under the 'Plugins' section. It should then unzip itself and automatically install.

Next, you'll notice a new menu added to the left hand menu, but to use any of the features it will ask you for your NewHaze consumer key and consumer secret. Get those by adding a site and copying the keys given to you.

Getting the games to show up on pages

There are two distinct ways of doing this. One of these is by modifying the template to show games on game pages. This is done simply by adding the following code where you want the game to appear.

<?php
echo'<embed type="application/x-shockwave-flash" src="'.get_post_meta(get_the_ID(), 'swf_url',true).'" width="'.get_post_meta(get_the_ID(), 'width',true).'" height="'.get_post_meta(get_the_ID(), 'height',true).'"></embed>';
?>

Example code for single.php is:

<?php get_header(); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
    echo
'<h2>Play '.get_the_title().'</h2>
    <div align="center"><embed type="application/x-shockwave-flash" src="'
.get_post_meta(get_the_ID(), 'swf_url',true).'" width="'.get_post_meta(get_the_ID(), 'width',true).'" height="'.get_post_meta(get_the_ID(), 'height',true).'"></embed></div>
    <h2>How to play</h2>
    <table width="100%"><tr valign="top"><td><p>'
.get_post_meta(get_the_ID(), 'description',true).'</p></td><td width="50">'.nh_favorite('square-rounded',false).'</td></tr></table>
    <h2>Comments</h2>
    '
.nh_comments(860,5,0);
    endwhile; else:
?>
        <p>Sorry, this game wasn't found.</p>
     <?php endif; ?>
<?php get_footer
(); ?>

The alternative is by adding a post template. This is done from the "NewHaze Settings" page in your control panel.

The sample post template page is:

<p>
    <img src="{picture-50x50}" width="50" height="50" style="float:left;margin-right:5px;" />
    {description}
</p>
<!--more-->
<p>
    {swf}
</p>
<p align="right">
    {fav-button}
</p>
<p>
    {comments}
</p>

This notation is relatively simple to understand. Simply add {name} where you want the game name to appear. Add {description} for the game description, {swf} for the game itself, {fav-button} for the favorite button and {comments} for game comments. You can then put a picture on by placing {picture-40x50} (where 40 would be the width and 50 would be the height, in pixels) in your page.


© 2012 NewHaze   Icons by Pixel Mixer   Help