In the last article about columns, we mentioned that tables were used in older WordPress versions to create columns. To add a table in WordPress website you would need to:
- Insert HTML code; or
- Install 3rd party plugin (for example TablePress)
Third-party plugins were the most common way because you were able to work with many additional functions and features. You could add header, footer or sort table data as you like.
Pricing table block
Because tables are usually used to present items and prices, we’ve created a special Price Table block, which is included in Citadela Blocks plugin (widely compatible with most of modern WP themes). You can use it very easily in WordPress block editor to present and administer prices in an attractive way.
This block has advanced settings and you can set up responsive version according to your needs. It is available in Citadela Blocks Plugin.
However, WordPress itself offers a default block for creating tables. Its called simply: Table block, and you can use it to create a very basic presentation, for example of your subscription packages, within a minutes.
Today we will look at Table Block in more details and talk about:
- Why are tables in WordPress practical
- How to use Table block and create a table in WordPress (without plugin)
- Table block settings in toolbar
- WordPress Table block settings in the inspector
- Extra tip: How to insert a table next to the image
Tables have universal usage in Posts and Pages. Basic functionality is to organize data or numbers. Tables are also beneficial for bloggers. For example travel bloggers can compare prices for individual destinations. Food bloggers can easily create list of ingredients or required quantity.
Last but not least it is possible to use tables to present opening hours or price tables of services and products. It does not matter if you have a website for a restaurant, beauty salon or bakery. You’ll find usage for tables on your website for sure.
Creating tables in WordPress using block editor is a piece of cake. Using Table block you can create tables in a few clicks without plugin or coding. Let’s have a look at how it works:
- As a first thing you need to insert WordPress Table block. You can do it by clicking on “+” that is located in the top bar or anywhere within the editor. After that, you can choose a particular block.
- It is also possible to insert Table block using slash “/“, following word “table” to search for table block.
- After adding Table block to your page or post, you have to set basic settings such as the number of columns and rows.
- Done. I’ve just created a simple table in WordPress without plugin in less than a minute.
Explore the newest Citadela theme, where you can create tables using WordPress Table block and also use our custom made blocks. Learn more about Citadela that you can customize with layout packages developed for specific types of business.
Now you know how to make a table in WordPress. Next we will show you how to work with it.
Top toolbar above the table allows you to make changes to styling and formatting. Using these settings you can change how will the table look like. Don’t forget that the final look always depends on the active WordPress theme that you use.
What can be changed?
1. Block styles
Using first icon you can select tables styles. You can choose one of 2 options:
- Default – table cells will have borders, without any background. Background color for the whole block can be added later.
- Stripes – table without borders, but every second line will be highlighted using a background. This style is more modern and less formal.
2. Aligning WordPress Table block
Table alignment can be also changed in the top toolbar above block. You can choose one of the classic ones such as left, right or center, but you can also make table wide or full width. The availability of the last two always depends on the active WordPress theme that you use.
3. Formatting table content
Text or numbers inside tables can be set to bold or italic. You can add link to other page, graph or image.
4. Text alignment in table
The latest version of WP ensures that it is possible to align not only the entire table but also the text inside the rows. You can now align inserted text on each line separately. This feature helps you create a nicer table.
5. Number of columns and rows
How to add table columns or rows in WordPress? In Table block, it’s very easy. This block allows adding or removing cells very quickly. Simply click on “Edit table” and after that, on the action, you would like to do. If you click on “Add Row After”, a new row will be created right away at the bottom.
While the top toolbar enables you to change settings for table cells, a right-side toolbar called Inspector is used for more complex settings of Table block. Also here you can configure block styles (Default or Stripes), but what more, you can also set background color and table width.
By default table cells dynamically adjust to the amount of text that is inside. You can also allow the function “Fixed width table cells”. All cells will have the same width no matter what you put inside.
Inspector also allows you to change table background color. If you have selected Default style, the whole table will have the same background color. If you have selected Stripes, only every second line will have background set.
Newly added feature: Support of header and footer
To make tables more accessible, developers added the header and footer option to the WordPress Table block. This functionality also provides better structural definition (of data) and gives more accurate information to mobile assistants. The table structure now includes
<thead>, <tfoot>, and
<tbody> to identify and distinguish the table’s header, footer, and body. You can enable or disable the header and footer section directly from Inspector.
Do you need to have a table and image side-by-side? To do it you need to use Columns Block. This block will allow you to insert different content types into columns and have them nicely aligned.
How to do it?
Insert Table Block into one column and Image Block into second. You’ll achieve a nested table inside WordPress Column Block next to the image. It’s very simple and you do not have to worry about alignment or responsive version.
You can read more about Column block in our article How to make columns in WordPress without plugin.