Plugin Directory

EidoGo for WordPress

EidoGo for WordPress makes it easy to embed SGF files in your WordPress-powered blog with the EidoGo SGF viewer and editor.

So, how do I embed an SGF File?

EidoGo for WordPress integrates with the WordPress media library thingy, so you can embed an SGF file exactly the same way as you would an image - the plugin will insert the necessary tags for you automatically.

You can also embed an SGF file manually, for instance:

    [sgf sgfUrl="/wp-content/uploads/2009/11/example.sgf"][/sgf]

By default EidoGo will be inserted with the "compact" theme. If your blog has a wide enough layout, you can use the "full" theme which adds nice things like a variation tree, larger comment box, etc.

    [sgf theme="full" sgfUrl="/wp-content/uploads/2009/11/example.sgf"][/sgf]

You can also specify the "compact" theme explicitly. By default, EidoGo instances will be embedded in an iframe to allow keyboard shortcuts to be used to navigate the game without stealing them from the user's browser. If you don't want to use iframes for some reason, you can specify themes of "compact-inline" or "full-inline" to embed the EidoGo instance directly. Keyboard shortcuts will be disabled, however.

Because SGF is a text based format you can also embed the SGF data directly in your post without uploading it as a separate file. Just open the SGF file in something like notepad, then copy and paste the SGF data between [sgf][/sgf] tags in a post, page or comment.

For example, this will embed a blank 19x19 board:

    [sgf](;GM[1]FF[4]CA[UTF-8]SZ[19])[/sgf]

How do I add a problem?

Specify [sgf theme="problem"] to activate EidoGo's problem mode. In problem mode iframes are not necessary, nor are used. For maximum usefullness I recommend putting comments at the end of each branch indicating if the branch is correct or incorrect, otherwise EidoGo gives no indication.

It's possible that EidoGo won't correctly determine which color should be automatically played (it tries to look for a PL[] entry in the SGF file), but you can override it by specifing, e.g. [sgf problemColor="B"] explicitly.

Can I embed as a static diagram image?

Yep, add the parameter image="true". This is also what gets inserted in RSS feeds since EidoGo obviously won't work there. Note: imagemagick needs to be installed on the server and in the path for this to work. If the plugin can't find imagemagick, it will insert static text instead.

What other parameters are there?

You can specify a caption for the EidoGo instance with caption="Caption". You can link the caption to some url with href="http://www.example.com/" if you, for example, want to link to some discussion of the game.

You can specify the loadPath parameter for EidoGo with loadPath="something" if you understand how to use that. As a shortcut for jumping to a move number in the main branch, you can specify moveNumber="72" or some such.

You can specify class="className" if you want to add a CSS class to the containing element (useful if you want to, for example, align a problem to the left of the screen instead of the right or something).

Can I see an example in action?

Yep.

I want to tweak the layout within my theme; what's the markup look like?

It's pretty simple:

<div class="wp-eidogo wp-eidogo-[theme]">
    <div id="player-container-[id]" class="player-container">
        ...iframe or EidoGo instance...
    </div>
    <script type="text/javascript"><!--
        ...some javascript to invoke EidoGo...
    --></script>
    <p class="wp-caption-text">[caption]</p>
</div>

The included styles will align EidoGo instances with the alignleft, aligncenter and alignright classes the same as one would expect for images, but you may want to add a few lines to your theme's stylesheet to match things like margins with the rest of your layout or to change how instances are laid out by default when no alignment has been specified.

I want to customize the appearance of EidoGo and need to load a stylesheet from within the iframe -- can I do that?

Yes. The plugin will check for the existence of a file called "wp-eidogo.css" within your theme's directory and will load it as necessary.

What other stuff can you do?

Try adding the random problem widget to your sidebar. It'll pull a random problem from any of the uploaded SGF problem files. Note: it only chooses from those in your media library (attachements). It won't include those embedded inline.

There's also a widget that lets you browse problems by category or difficulty, and one to browse games by category. For this to work nicely, you'll want to make sure your theme does a good job of handling WordPress's custom taxonomies (which is what the plugin uses to categorize problems) and can invoke eidogo to display SGF attachments. Check out the eidogo-for-wordpress/examples directory, and also the next FAQ question.

Can I make SGF files show up nicely on the attachment page?

Yep, a convenience function is included; you'll just have to edit your theme's attachment.php. Right now, the main part of it probably looks something like:

...
<?php if ( wp_attachment_is_image($post->id) ) ... ?>
    ...
<?php else : ?>
    ...
<?php endif; ?>
...

You'll want to add some code to treat SGF files in a special way.

...
<?php if ( wp_attachment_is_image($post->id) ) ... ?>
    ...
<?php elseif ($post->post_mime_type == 'application/x-go-sgf') :
    echo wpeidogo_embed_attachment($post);
?>
<?php else : ?>
    ...
<?php endif; ?>
...

By default, wpeidogo_embed_attachment() will use the same options as are saved with the SGF file in your media library, but it also takes parameters...

wpeidogo_embed_attachment($post, $class, $caption, $href, $theme, $method)

All except the first (the attachment iself) are optional. So if you want to center the SGF file, pass 'aligncenter' for $class. By default, $class is null, $href is a direct link to download the SGF file (the other parameters use the saved values.)

Take a look in the eidogo-for-wordpress/examples/ directory to see some files from my theme that handle this.

How did you get the really compact layout with tiny stones in that screenshot of the random problem widget?

As of version 0.8.7 of the plugin, this should be handled automatically.

I'm getting an error message in Internet Explorer 6 (or older) telling me to upgrade.

Yeah, the plugin doesn't work with IE 6 or older. EidoGo can be made to work with IE 6, but it's not something I'm going to waste my time on. If you really need IE 6 support, I can e-mail you more details on the exact nature of the problem and will accept patches, but you should really just upgrade to a real web browser.

I intend to support current or reasonably recent versions of Firefox, Google Chrome, Opera, Safari and Internet Explorer (which means pretty much any Gecko or KHTML browsers are probably covered). I've tested the plugin with various recent versions of Firefox, Chrome, IE 7 and IE 8 so far.

I'm getting an error message and I have PHP 4

Right now, PHP 5 is required and I don't have a PHP 4 setup to test with. Sorry. If you feel like writing a patch, I'll take a look.

I'm having some other problem

Oh, maybe I screwed up. Send me an e-mail.

Requires: 2.8 or higher
Compatible up to: 3.0.5
Last Updated: 2010-9-10
Downloads: 843

Average Rating

4 stars
(4 ratings)

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1
100,2,2 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,2,2 0,1,0
100,1,1
100,1,1