For any website / mobile app / software needs, contact Imran: +91 95661 66880 /
We are now the technology partners for YieldMore, a venture for quality and holistic progress.

Html Generator


Often in wordpress, its easier to build a page dynamically from php.
Earlier I have tried running the php file on the fly (via a shortcode), but realised that this way, the content is not stored in the wp_posts table and will not be indexed / show up in site search.

The solution to this is to have a php file that can be run each time the content changes and replaces the page. This is a part of the CS Admin Plugin.

The most common use of this feature is to generate code off of tabular data (a spreadsheet).


How To

Once it is installed, You can go to Tools / Html Gen.

Update an Existing Page

For each existing page, you will see 3 links
The first opens the php file in the editor.
The second is to view the page in the website
The third is to edit the page in wordpress.

To make changes, open the php file. You will see php code, and a part which says

$data = tsv_to_array('#___

This is the portion that needs to be replaced from the spreadsheet.
Before doing so, make sure the sheet has
– The first column starting with a # (so it can be ignored)
– Either ” or ‘, but not both. In this case ‘ is not allowed since its used in the tsv_to_array call.
– No line breaks in any of the cells.

Then copy from the sheet into this file, replacing the contents #___
___, but keeping the starting and ending single quotes ‘ like so:

Once you have done this, go to the bottom and save the page.
Then come back to the Html Gen window and click generate page.
A preview will be shown.
If all looks good, click publish.
If there is an error, you will have to go back and fix the php file / modify it.

NB: Kindly note that the generated page content will start with an html comment, so please advise editors not to change it.

Create a new page

There is a box on the top right where you fill in the name and the post id and click create.

The php file saying “sample content” will be created, you can edit it, use any wordpress / php functions and follow the steps above to publish it.

The php file must not include any logic that is expected to run on viewing the page since it is only run manually in admin when publishing changes.

Files commonly use the tsv_to_array function added by the same plugin, and the link shortcode from the Companion Plugin.

NB: Plans for expansion
– External tsv file that if detected, opens in the plugin editor
– Code highlighter for php
– Support for line breaks in the tsv file.