How to use shortcode ‘wpdataaccess’

Use shortcode wpdataaccess to show database tables and views on your website. jQuery DataTables is used to provide dynamic HTML tables supporting pagination, sorting and searching. Choose between flat or responsive tables.

 

IMPORTANT

You need to explicitly grant access to tables shown on your website! Your table and view data will not be shown on your website without this step! Follow these steps to grant access to a table or view you allow users to add it’s content to your website:

  • From the menu click “WP Data Access” > “Manage Plugin”
  • Click on tab “Front-End Settings”
  • Click on the table or view your want to grant access to (multiple selections possible)
  • Save your front-end settings

Shortcode Parameters

The following parameters are supported:

  • pub_id (publication id)
  • table (table or view name)
  • columns (comma seperated list of columns, default: * = all columns)
  • responsive (yes or no, default: no)
  • responsive_cols (number of columns shown on the table, default = 1)
  • responsive_type (modal, collapsed (default) or expanded)
  • responsive_icon (yes or no, default: yes)

Data Publisher

You can use the Data Publisher to create a publication. Every publication created with the Data Publisher tool has a unique publication id (pub_id). If you add parameter pub_id to your shortcode, all other parameters are taken from your publication. No further action is needed. The shortcode for a specific publication can be copied to your clipboard with the Data Publication tool and looks like:

[wpdataaccess pub_id="17"]

User defined shortcodes

You can also add a shortcode manually. For manually added shortcodes parameter table is mandatory. All other parameters are optional. Tables are shown in flat format by default. In it’s simplest form usage looks like:

[wpdataaccess table="wp_customers"]

 

This will display a flat table showing all columns. You can limit the number and order of columns shown by providing parameter columns. The following example will only show the columns name, address and city in that particular order:

[wpdataaccess table="wp_customers" columns="name,address,city"]

 

The default value for parameter responsive is “no”. If you omit this parameter, a flat table is shown and parameters responsive_cols, responsive_type and responsive_icon are not taken into account.

Use parameter responsive = “yes” to add responsive tables to your website. Parameters responsive_cols, responsive_type and responsive_icon can be used to manage the layout and behaviour of your responsive tables. For example:

[wpdataaccess table="wp_customers" columns="name,address,city,ID" responsive="yes" responsive_cols="1" responsive_type="modal" responsive_icon="yes"]

Was this article helpful to you? Yes No