In this post I’ll write about another problem with a WordPress plugin. Blogger, for whom I’m managing the WordPress installation, had another wish for plugin customization. The installed WP-Table Reloaded plugin enables the user to create a table and add contents to it’s cells. But it isn’t able to sort the already added entries in the table or shifting the entries for inserting a new cell.
So the choice was to write another plugin or make a script that rearranges the entries by a specific condition, because the plugin supports the exporting and importing the HTML tables. I chose the letter one and wrote a Python3 script.
The exported HTML file can be reorganized in this ways: specify the new number of wanted columns, choose a horizontal (same as an input file) or vertical rendering and specify a regular expression for sorting the entries. Specifying “0” for sorting disables it and putting “(a)” for regular expression option sorts the elements by text between [a] HTML tags.
Here you can download the Table reorganization for WP-Table Reloaded WordPress plugin script.
Update on 6th of August: Corrected the rendering when multiple [a] tags exist in a single cell. Fixed vertical rendering when there the number of elements didn’t fill the whole columns*rows box.