In this section, I will walk through the process of importing PGN games into the WordPressChess plugin.
When you import a pgn, the pgn will be saved as a database. A database is a collection of games.
Now, find the Import PGN menu item and click it.
This will bring you to the import PGN page. Here, click the choose file button to choose which file to upload. Navigate to the folder where you have a pgn file and select it.
Then give the database a name in the text below. To name your database is optional. If you leave it empty, the database will be named the same as your pgn file(except the .pgn extension).
If everything looks ok, click the “Import” button. The import may time some time since the plugin has to parse all the games into JSON format which is saved in the database. JSON is just a format which is easily readable by a computer.
Once the import is completed, you will see a confirmation message like below:
Notice the ID(here ID: 7) at the end. This is the id you can use when inserting shortcodes. If you forget it, you can easily find it in the game editor as seen below.
Now, I’m ready to show the games from this database inside this post using a shortcode. The short codes for database games has a format like this:[chess db="your id" tpl="which template to use for rendering"]
The short code admin menu is useful when finding shortcode. In the picture below, I have selected database template 1, and I'm choosing to show it using the brown theme, i.e. overriding default selected theme for my site.
On that page, I can see that it says that the shortcode is:[chess tpl="3" db="<databaseId>" theme="brown"]
all values are set except db. When importing the pgn, I noticed that the ID of my pgn was 7, so I'm going to use this short code:[chess tpl="2" db="7" theme="brown"]
Now, I'm adding my new post and inserting the shortcode where I want the board to appear. Here it's shown below