Advanced Shortcode Usage

Basic Usage: 

To show your table you can use the following shortocode:

[ninja_tables id='YOUR TABLE ID HERE']

Advanced Usage of Ninja Tables Shortcode

Ninja Tables Pro Comes with handy shortcodes parameters where you can customize the features into the shortcode so you can show the same table in a different way on a separate page.

Available Shortcode Parameters:

Shortcode ParamenterDescription
per_pageYou can specify how many rows will show in ninja table’s per page
Value Type: Number
searchYou can enable or disable search bar
Possible Value: 0 or 1
sortingYou can enable / disable data sorting features 
Possible Value: 0 or 1
hide_headerYou can show / hide the header row
Possible Value: 0 or 1
logged_in_onlyYou can show a table only for logged in users.
Value: 0 or 1
( if value = 1 then table can be visible only for logged in users )
get_filterYou can set search filter from URL’s get parameter
Provide the filter name and then Ninja Table will filter the table data from your browser’s get parameter
filterYou can add filter parameter as pre-defined search value for the table
filter_columnYou can specify in which column the “filter” will be applied. You have to provide the column key
hide_default_filterIf you use filter parameter and want don’t want to show hidden values even after reset the filter in frontend then you can set this value as ‘yes’
columnsYou can specify which columns key will show. Just specify the column keys as comma separated value then that columns will show only.
filter_selectsIf you use custom filters UI for your table and you can set pre-defined value for the select elements.
Basic Usage: filter_selects=’FILTER_TITLE=defaultValue’

If you want to add multiple pre-defined selected value you can do that like this:

filter_selects=’FILTER_TITLE_1=defaultValue1|FILTER_TITLE_2=defaultValue2′
limitIf you want to limit the data then you use this parameter.
Example: limit=’20’
It will show only 20 rows from your table’s data source.
skipIf you want to skip few rows from your table’s data source then you use this parameter.
Example: skip=’10’
It will skip first 10 rows from your table’s data source.
infoThis parameter let you show the table meta info after pagination.
Example: info=’Current Page {CP} of {TP}’

Placeholders:
{CP} – The current page.
{TP} – The total number of pages available.
{PF} – The first row number of the current page.
{PL} – The last row number of the current page.
{TR} – The total number of rows available.

Examples

Please Note that, Advanced Shortcode is available only in Pro Version of Ninja Tables

Date range filter- shortcode

If you have a table like this with a date column and you want to filter initially with the date or date range you get the option from ninja table 3.4.1
Please update your plugin to the latest version and use date range filter by shortcode.

To filter by date range:
filter="~{date:M/D/YYYY}:{date:M/D/YYYY}" filter_column="date"
To filter date before 7 days to next 1 day:
filter="~{date-7:M/D/YYYY}:{date+1:M/D/YYYY}" filter_column="date"
For greater than use:
filter="{gt}{date:M/D/YYYY}"
For Less Than use:
filter="{lt}{date:M/D/YYYY}"
use on your shortcode.

Here filter_column shortcode is used to select the column that you want to filter.
NB: Date format must be the same as the column date format.

Other Shortcodes – Table Info

There has helper shortcode for ninja tables where you can show the following informations easily.

  • title
  • description
  • total_rows // Will work only for default table
  • last_modified
  • last_editor

Usage:

[ninja_table_info id='YOUR TABLE ID HERE' field="INFO_FIELD"] 
The following parameter can be used for field: 
title 
description 
total_rows 
last_modified 
last_editor

Table Cell Info

There has a helper shortcode where you can show your table cell data for a particular table.

Usage:

[ninja_table_cell id='YOUR TABLE ID HERE' row="YourROWID" column="YOUR_COLUMN_KEY"] 
You will get the ROWID for default data source tables. But if you have a table with external data source or wp-posts / csv integration then your shortcode should look like this: 

[ninja_table_cell id='YOUR TABLE ID HERE' row_id="YOUR_ROW_INDEX" column="YOUR_COLUMN_KEY"]

This shorcode will print the data of that specific cell data.

Was this article helpful to you?

5 8

How can we help?

Please submit a support ticket if you have any question or pre-sale questions. Our Customer support engineers will answer your query as soon as possible

Open a support ticket