wordpress
  1. wordpress-table

Table - WordPress Advance

Syntax

To create a table in WordPress, use the following syntax in the text editor:

[table]
    [thead]
        [tr]
            [th]Header 1[/th]
            [th]Header 2[/th]
            [th]Header 3[/th]
        [/tr]
    [/thead]
    [tbody]
        [tr]
            [td]Cell 1[/td]
            [td]Cell 2[/td]
            [td]Cell 3[/td]
        [/tr]
    [/tbody]
[/table]

Example

Here is an example of how to create a table with two rows and three columns:

[table]
    [thead]
        [tr]
            [th]Name[/th]
            [th]Age[/th]
            [th]Country[/th]
        [/tr]
    [/thead]
    [tbody]
        [tr]
            [td]John[/td]
            [td]25[/td]
            [td]USA[/td]
        [/tr]
        [tr]
            [td]Sara[/td]
            [td]32[/td]
            [td]Canada[/td]
        [/tr]
    [/tbody]
[/table]

Output

The above example will produce a table like the following:

Name Age Country
John 25 USA
Sara 32 Canada

Explanation

Tables are used to display data in an organized format. WordPress provides a shortcode [table] to create tables with headers and cells.

Use

Tables can be used to display any kind of data - from simple lists to complex data sets. They can be used in blog posts, product pages, or any other page that requires the presentation of data in a structured manner.

Important Points

  • Use headers to clearly define the contents of each column
  • Use <tbody> to group table rows together
  • You can also add <tfoot> to add a footer to the table

Summary

Tables are useful elements for displaying data on WordPress websites. By using the [table] shortcode and formatting it properly, you can create tables that are easy to read and navigate. Remember to use headers to clarify the columns and group rows together using <tbody>.

Published on: