The WordPress WYSIWYG editor is pretty okay, but it leaks a few things, such as tables. And tables are pretty important, especially if you are writing reviews or posts where you compare different products.
Fortunately, there’s a solution for this. The popular TablePress plugin allows us to create and insert tables into posts and pages with an easy to use almost drag and drop editor.
In this article, I’ll go through some of the features of the plugin and also how to create a table and insert it into a post.
Let’s get to it, shell we?
Here’s a quick overview of what we’ll take a look at:
How to Add a New Table
How to Insert a Table into a Post
How to Import a Table
How to Export a Table
How to Add a New Table
First of, to add a table, you need the plugin, which you can find on WordPress.org, or download it from your dashboard by searching for TablePress.
After you downloaded and installed the plugin, a new menu item will appear in the left side navigation menu in the admin dashboard, called TablePress. This is where you can manage and create all your tables.
How to Add Tables in WordPress
Now that we have the plugin installed we can crack on creating a new table. Go to TablePress -> Add New Table.
Here you can name your table, give it a description which is optional, and define how many columns and rows it has. Don’t worry this can be changed while populating the table.
After you gave it a name, press Add New and you’ll be sent to the actual creation page. Here you can populate your table, add new rows or remove them.
Adding Content to the Table
To add content to the table cells, simply click on them and start typing.
Manipulating the Table
You can use the options below to add new rows/columns to your table, combine rows, hide or show specific columns and rows, by selecting them and clicking the specific button.
It can be a little bit tricky sometimes, but basically, if you want to combine cells, you first click the combine cells, rowspan if you want to combine two columns that are near each other and colspan if they are above each other. Then you click on the columns you want to merge.
Don’t worry a popup will show up when you click these buttons explaining what you need to do.
The same works for inserting a link, image or advanced editor. First, click the button, then the cell you want to interact with.
The table options allow you to set table headers and footers, to alternate row colors and make zebra tables and to highlight the row that you hover over with the mouse.
You can also print the tables name and description below or above the table.
And finally, you can add some custom CSS Classes to style the table in case you want this particular table to look different from your other tables.
The table features are more for front-end customization, such as allowing the table to be sorted by different columns, search/filtering option.
You can also set the table to break into multiple pages and have a pagination after 10 rows for example, and have a horizontal scrolling if the table has more columns than what can fit in the content area.
There are also some custom commands you can use, that will be added to the JS call. This is mostly for advanced users, so if you are just starting out, you can ignore this.
After you are done with your table, everything is filled out, you can preview it to see if you need to add any of the above features.
Maybe you have too many columns and they don’t fit properly with your theme, or you want to add a search/filter feature.
If all this is done, you can press Save Changes and you have your table!
How to Insert Tables into a Post
To insert a table into a post after you’re done creating it is very simple. Simply copy the shortcode from the table information section, that looks something like this: [table id=2 /] And paste it where you want your table to appear
Or, you can use the button in the post editor and insert it from there.
And when you preview the post, your table should be there:
The plugin also allows you to import already existing tables, be it an excel file, or a table from a URL.
For the purpose of this tutorial, I made a random table, with 10 posts in it. The table has 4 columns, one for the ID, one for the Title, one for the Views and finally the Author.
Once you have your table, go to TablePress -> Import Table.
Here you can import tables by uploading them, entering a URL, browsing on the server files, or manually entering the table code.
You can have your table in the following formats: CSV, HTML, JSON, XLS or XLSX
Once you selected the desired table, you can choose to add it to a new table, replace an existence, or extend the other table.
Then make sure to choose the right format the matches the file you want to upload, otherwise, some weird things can happen.
After this, you can click import, and you’ll be returned to the table editing page, where your table will already be populated with the data from the file you uploaded.
You can choose to edit it, mess around with it, or just publish.
Exporting a Table
Exporting a table you created or imported previously is really simple. Go to TablePress -> Export Table.
Here you’ll be presented with a few options.
The first thing you need to do is select the table you want to export, or you can export them all at once. If you select more than one table, it’ll automatically be added to a zip archive. If not, that option is optional.
Then select the file format, currently, support formats are : CSV, HTML, and JSON.
Once you are happy with the settings, simply click Download Export File and it’ll ask you where to save the file.
A few things to note
One thing to note is that if you have other plugins that might add the shortcode [table] you’ll be asked to rename that shortcode. But for me, it was done automatically.
Also in the options page of the plugin, you can add custom CSS to change the style of the tables, and you can also set what permission level is required in order to be able to access the tables.
All in all, I think TablePress isn’t the easiest table plugin to use, but the features it has, make up for that. I’ve used it for some time now, and after you get used to it, it’s really easy to create and add tables in WordPress.
I hope you found this tutorial/overview of TablePress useful. Feel free to let me know what you think about it! Also if you use another plugin for this, also let me know!