User_Notes_wordpress

wordpress.org blog platform integration

  • through the pgn4web wordpress.org plugin embed-chessboard
  • through a generic plugin enabling iframes

A wordpress.org based site can integrate the pgn4web chessboard in either of two ways:

The pgn4web test wordpress site provides an implementation example (this is a test site, things might occasionally be broken).

using the pgn4web embed-chessboard plugin

The pgn4web wordpress.org plugin embed-chessboard is available from the pgn4web downloads and from the wordpress.org plugin directory.

screenshot

integration guidelines

The following instructions refer to the latest version of the plugin, please check the download section.

Recommended installation method is from the plugins section of the administration pages of your site, searching for the "Embed Chessboard" plugin.

As described with more details in the README file within the plugin, the plugin allows for a shortcode tag to display chess games, like this:

[pgn parameter=value ...] 
... chess games in PGN format ...
[/pgn]

Shortcode tag parameters:

  • layout=horizontal|vertical
  • height=auto|number
  • showMoves=figurine|text|puzzle|hidden
  • initialGame=first|last|random|number
  • initialVariation=number
  • initialHalfmove=start|end|random|comment|number
  • autoplayMode=game|loop|none

Example:

[pgn height=500 initialHalfmove=16 autoplayMode=none]

[Event "World championship"]
[Site "Moscow URS"]
[Date "1985.10.15"]
[Round "16"]
[White "Karpov"]
[Black "Kasparov"]
[Result "0-1"]

1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nc6 5. Nb5 d6 6. c4 Nf6 7. N1c3 a6 8.
Na3 d5 9. cxd5 exd5 10. exd5 Nb4 11. Be2 Bc5 12. O-O O-O 13. Bf3 Bf5 14.
Bg5 Re8 15. Qd2 b5 16. Rad1 Nd3 17. Nab1 h6 18. Bh4 b4 19. Na4 Bd6 20. Bg3
Rc8 21. b3 g5 22. Bxd6 Qxd6 23. g3 Nd7 24. Bg2 Qf6 25. a3 a5 26. axb4 axb4
27. Qa2 Bg6 28. d6 g4 29. Qd2 Kg7 30. f3 Qxd6 31. fxg4 Qd4+ 32. Kh1 Nf6 33.
Rf4 Ne4 34. Qxd3 Nf2+ 35. Rxf2 Bxd3 36. Rfd2 Qe3 37. Rxd3 Rc1 38. Nb2 Qf2
39. Nd2 Rxd1+ 40. Nxd1 Re1+ 0-1

[/pgn]

When using the gutenberg editor, please add shortcodes as shortcodes blocks in guntenberg.

Please note the submenu within the administrator settings menu, allowing the site administrator to configure the horizontal or vertical position of the header/moves text respect to the chessboard, to match colors to the site template and to control the game autostart behavior at page load.

Other chessboard settings have been fixed in the plugin; if you really need to change those settings, the plugin code needs to be modified, look in file embedchessboard.php at the parameters passed to board.html and refer to the board widget instructions wiki page or ask for support. Please also note the plugin package has only one set of bitmaps, if you want to change bitmaps type/size you can find the whole set in the main pgn4web package.

advanced parameters

The settings of the advanced parameters section of the plugin should normally be left blank, improper values will break the chessboard display.

Please note that the wordpress template might alter the appearance of the pgn4web board widget, in particular the width of the chessboard. If this happens, the advanced settings section of the administrator page provides the option of setting the CSS style for the HTML DIV container of the plugin frame. The content of this parameter is directly copied in the style attribute of the DIV container and must comply with the CSS syntax. For instance, to force a fixed width to the chessboard frame, the CSS style for the HTML DIV container could be set to:

width:500px;

Please leave the advanced parameter blank unless you have a problem with the template and you know what you are doing.

In addition, the chessboard object is controlled using the chessboard-wrapper css style that as a last resort you can tweak to your needs.

caveats

  • the plugin requires that the "wordpress address (URL)" and the "blog address (URL)" in the wordpress general settings belong to the exact same domain; for instance having the former as "http://www.example.com/wordpress_files" and the latter as "http://example.com/wordpress_blog" (without the "www.") would break the plugin; domains should be either both "www.example.com" or both "example.com" regardless of any redirection.
  • HTML tags are stripped from the PGN data, removing all text between < and > characters; please make sure your PGN data does not contain < and > characters.
  • some site administrator, deploying the embed-chessboard plugin in conjunction with cache functionality (either the default wordpress object cache or a more sophisticated plugin) reported the occasional need to clear the cache while upgrading/reconfiguring the embed-chessboard plugin. Actual method of cleaning the wordpress cache depends on the used caching mechanism.
  • depending on the wordpress theme in use, the category/tags view might not show the entire post but only an excerpt. Also depending on the theme, the excerpt might get stripped from HTML tags. The embed-chessboard plugin uses the <textarea> and the <iframe> tags, hence the chessboard display might get broken when in category/tags view. Some themes allows for configuring the excerpt, for instance the atahualpa theme allows specifying which HTML tags should not be stripped from excerpts. By preserving the <p>, <textarea> and <iframe> tags then the chessboard is properly displayed in the category/tags view. Please check the behavior of your theme if the pgn4web chessboard is not displayed correctly when in category/tags view.

using a generic plugin enabling iframes

Several plugin enabling iframes are available, such as the embed iframes plugin. For instance, the iframe plugin could be used in a blog post with the URL from the pgn4web board generator tool as the iframe URL. This is a less straightforward (requires using the board generator tool) but more flexible option (easier to modify colors and layout).


Related

Wiki: BoardWidget_generator
Wiki: BoardWidget_instructions
Wiki: Contribute
Wiki: Features_Limitations_Bugs
Wiki: Index
Wiki: User_Notes_Web_Platforms

Discussion

  • Anonymous

    Anonymous - 2012-01-03

    Originally posted by: pa...@casaschi.net

    FAQ: how to use the plugin for a live games broadcast?

    While a number of options have been developed specifically for using pgn4web for live games broadcasts, the plugin can also be used for a live games broadcast; although not a supported feature, the following instructions might help:

    1. make sure a PGN file is available on the same server as the plugin and constantly updated with the latest game scores; assume for example the PGN file is available as /games/live.pgn
    2. enter the following code in your post: [pgn eo=t hd=l am=n ih=e rm=1 pd=/games/live.pgn] [/pgn]
     

    Last edit: Paolo Casaschi 2016-06-06
  • Anonymous

    Anonymous - 2012-01-07

    Originally posted by: pa...@casaschi.net

    FAQ: how to use the plugin with PGN files?

    The supported setup requires providing the PGN data within the [pgn] ... [/pgn] tag as described above, however the plugin can also be used with PGN files; although not a supported feature, the following instructions might help:

    1. make sure a PGN file is available on the same server as the plugin; assume for example the PGN file is available as /games/games.pgn
    2. enter the following code in your post: [pgn eo=t pd=/games/live.pgn] [/pgn]
     
  • Anonymous

    Anonymous - 2015-02-04

    Originally posted by: pa...@casaschi.net

    FAQ: how to display a larger chessboard with the plugin?

    In order to minimize the plugin size and complexity a number of choices have been made regarding the chessboard display and options, such as the chessboard size. A frequent question is how to display a larger chessboard; although not a supported feature, the following instructions might help:

    1. make sure you have the latest version of the plugin from the downloads page
    2. get the latest pgn4web-x.xx.zip file from the downloads page
    3. copy the images from the zipfile onto your site, for example in a folder accessible as /pgn4web
    4. post your games with these additional options: [pgn eo=t pfr=/pgn4web ss=N h=M] your PGN text here [/pgn] where N and M are two numbers; N is the square size, try 30, 40, 50 or other numbers
    5. once you find the optimal value of N, you will notice that the chessboard frame might cut the chessboard in the middle. This is where you need to set the value of M higher and higher (start from Nx8 and grow) until the whole chessboard is shown. For each N value you will need to find different values for M, depending on using the vertical/horizontal layout and depending on posting a single game (without a dropdown menu above the board) or multiple games (you need to make space for the game selection dropdown menu above the board). The normal plugin sets all this for you automatically if you keep the default square size; if you want to change square size you have to fix those values manually as described.
    6. once you have selected the values for N and M, you can avoid adding those to each individual chessboard by entering M as the chessboard frame height configuration parameter within the plugin settings and pfr=/pgn4web ss=N as the extended options configuration parameter within the plugin advanced settings
    7. other extended options are available, browse to the plugin file board.html?h=t for info and use at your own risk
     

    Last edit: Anonymous 2018-05-08

Log in to post a comment.