How to add tables in your WordPress pages

Tables might be out of date when it comes to website creation but they are the ideal tool to present tabular data with. Creating a table in WordPress was quite hard because the user needed to write the markup manually so the need arose for plugins which could do that more intuitively, the most popular among them being TablePress. However with the block editor the tables have turned and there is now a core block which can be used to easily and quickly create a table and add it to the content.

Table of contents

  • The Plugin
    • Installation
    • Creating a table
    • Embedding the table with the shortcode block
    • The table
  • The core table block
  • Wrapping up

The plugin

TablePress is a very popular free WordPress plugin which makes table creation and management a trivial task. It presents the user with a spreadsheet-like interface for adding and editing data so no coding knowledge is required, data can be imported and exported from/to excel, csv, JSON and more. Sorting, pagination and table filtering are also available to the user.

Installation

TablePress is a free plugin and it is distributed via the WordPress plugin directory, making its installation pretty easy. Navigate to Plugins > Add New and search for TablePress, from the results click the install button on the TablePress card and activate it once the installation is done.

The plugin does not offer much of general settings, they can be accessed under TablePress > Settings.

You have the option to add custom CSS to modify the tables’ default styling, and also pick where to display the TablePress menu entry.

Creating a table

To start creating your table navigate to TablePress > Add New and fill in the table’s title, description and its size.

Next click the add table button to get started.

In the next screen you can add the data to the table. After adding the data you can manipulate the table by adding or removing rows and columns merging cells and more. You can also toggle the table’s header and footer, create a stripped table layout, toggle sorting, filtering and more.  Once you are done configuring the table you are ready to publish and use it.

Embedding the table with the shortcode block

Since TablePress does not offer a custom block you will have to utilize the shortcode block to embed the table in your content. To get the shortcode just navigate to the TablePress tab in your dashboard, hover over the table you want to use and click the show shortcode link.

Copy the shortcode and create a new post or page. From the block finder search for the shortcode block and add it to the content.

Paste your shortcode in the block and publish the post.

The table

Your table is now embedded in your content and ready to be used.

The core table block

The block editor offers a core table block which allows you to create simple tables easily without having to write the table markup yourself. Search for table in the block finder and select the block.

After adding the block you have to select the table size and select the table style between the default and one with stripes.

Next click the Create Table button to start adding your data.

The block offers a few options to modify the table cell width and toggle the header and footer sections.

The table is now ready to be published and viewed.

Wrapping up

Adding tables in WordPress content is a lot easier than it used be. Both custom plugins and the core block can assist you in creating a table to display your data quickly without having to write the markup yourself. The core block is ideal if you want to quickly display some data and don’t have a need for any advanced functionality. If on the other hand you need to offer searching, filtering and sorting to your readers third party plugins like TablePress are the way to go.

The post How to add tables in your WordPress pages appeared first on CSSIgniter.

blank

Posted by Web Monkey

blank