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 and responsive tables.
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
The following parameters are supported:
- pub_id (publication id)
- pub_name (publication name)
- database (schema name)
- table (table or view name)
- columns (comma seperated list of columns, default: * = all columns)
- sql_orderby (ordering, for example: 4,desc)
- 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)
- filter_field_name (field name(s) to be filtered)
- filter_field_value (field value(s) to filter, performs a LIKE and therefor allows wildcards)
You can use the Data Publisher to create a publication. Every publication created with the Data Publisher has a unique publication id (pub_id) and a unique publication name (pub_name). If you add parameter pub_id or pub_name to your shortcode, all other parameters are taken from your publication. Only parameters filter_field_name and filter_field_value can be used to add a runtime filter.
The shortcode for a specific publication can be copied to your clipboard with the Data Publication tool and looks like:
When you transfer a publication to another server, the publication id might change. For this reason parameter pub_name was introduced, which you can use to test and publish a publication on different hosts. Example:
wpdataaccess pub_name="My Publication"]
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:
For security reasons shortcode parameter sql_where is no longer available. Please use parameters filter_field_name and filter_field_value to add a safe filter . The plugin still allows to add a safe where clause on the Data Publisher data entry page.
wpdataaccess pub_id="18" filter_field_name="lastname" filter_field_value="jose%"]
wpdataaccess pub_id="6" filter_field_name="job,ename" filter_field_value="president,ford"]
For filters containing multiple column names and values, use a comma seperated value and make sure the array size of filter_field_name and filter_field_value are the same. The filter allows to use % as a wildcard.