The argument “cols” is used to define your columns inside the table. If you customize the columns. It doesn’t matter if you use only some default wordpress build-in post fields (e.g. title, published, author) or if your use your own created custom post fields (e.g. in this demo database like lastname, firstname, street, ZIP, city, Logo, Vehicle, Model, Manufacturer,Country,Year,…….). Feel free to mix both types of post fields to build a professional DataTable.

Syntax

[[jsdatatable cat=YourCategory cols=title,published,YourCustomField2,YourCustomField1,author]]

EXAMPLE:

[[jsdatatable cat=YourCategory cols=lastname,firstname,Street,ZIP,City,published]]

Defaults

Without any argument “cols“, the following internal setting will be operated:

cols=title,published,author

Note

WordPress is case sensitive while using fieldnames! Take care about notation, when using the cols-argument. The default post fields your write in this manner:

THIS IS RIGHT ⇒ cols=title,published,author 
THIS IS WRONG ⇒ cols=Title,Published,Author

To handle custom post fields in the DataTable, the notation depends on how you named your own fields before! In our demo (including the cars and motorbikes) we have 7 custom post fields. All this custom post fields in the demo database we give fieldnames where the first character is a upper-case-character. Therefore of course we have to apply exact this kind of notation inside the cols-argument now:

THIS IS RIGHT ⇒ cols=Logo,Vehicle,Model,Manufacturer,Country,Year,Write-Up
THIS IS WRONG ⇒ cols=logo,vehicle,model,manufacturer,country,year,write-up

A mix (default wordpress fields and our own custom post fields) would look like this:

RIGHT ⇒ cols=Logo,title,Vehicle,Country
THIS IS WRONG ⇒ cols=logo,title,vehicle,country
THIS IS WRONG ⇒ cols=Logo,Title,Vehicle,Country


COLS ⇒ Some live examples

Please click on the links below and check out the difference:

[jsdatatable tag=example-cols cols=pos,title,comment head=”POS,Use this shortcode:,Note” orderby=pos  dropdown=off  searching=off navinfo=off]