the pgn shortcode

In this article, we will see how we can use the pgn shorttag to render a game from pgn on your WordPressChess enabled site.

The pgn shortcode:

This is an example of the shortcode:

[pgn]
[Event "Immortal game"]
[Site "London"]
[Date "1851.??.??"]
[Round "?"]
[White "Anderssen,A"]
[Black "Kieseritzky,L"]
[Result "1-0"] 

1.e4 e5 2.f4 exf4 3.Bc4 Qh4+ 4.Kf1 b5 5.Bxb5 Nf6 6.Nf3 Qh6 7.d3 Nh5 8.Nh4 Qg5 9.Nf5 c6 10.g4 Nf6 11.Rg1 cxb5 12.h4 Qg6 13.h5 Qg5 14.Qf3 Ng8 15.Bxf4 Qf6 16.Nc3 Bc5 17.Nd5 Qxb2 18.Bd6 Qxa1+ 19.Ke2 Bxg1 20.e5 Na6 21.Nxg7+ Kd8 22.Qf6+ Nxf6 23.Be7+ 1-0 
[/pgn]

The tag has this format:

[pgn]pgn string[/pgn]

Attributes

The code above is the [pgn] shortcode in it’s simplest version. It will show the game using default selected layout and the first game template(the tpl attribute).

Below you will find two boards for the pgn above, the first one using our default settings, i.e. no extra at default and the second one with attributes tpl and theme set. [pgn tpl="5" theme="brown"]

Anderssen, A vs Kieseritzky, L

Share This:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *