tablepress-pods/README.md

3.4 KiB

tablepress-pods

Abstract

Create Tablepress tables which summarize and display information from Pods

Description

This project is an extension to the TablePress plug-in (see https://tablepress.org/) for WordPress (https://wordpress.org/). It is not useful without the TablePress plug-in. This project is not part of TablePress, but designed to work with it and extend its capabilities.

This project also assumes that you have installed the Pods plug-in (see https://pods.io/) in your WordPress installation. It is also not useful without the Pods plug-in.

The tablepress-pods extension allows you to extract and display in Tablepress tables information from the content in Pods custom post types and taxonomies. If you use Pods and would like to produce tables from the information you've stored in them, this extension is potentially very useful.

Installation/Upgrade

Download a release from https://code.studioinfinity.org/glen/tablepress-pods/releases (as a zip file) and install and activate in your WordPress site like any other extension in zip format. Namely, from your Dashboard, you can:

  1. Select Plugins from the left-hand menu bar.
  2. Click on "Add New" and then "Upload Plugin."
  3. Browse to the downloaded zip file on your local disk, and click "Install Now."
  4. If this is an upgrade, it will show you the currently installed version and the new version and ask you to confirm the replacement.
Usage

This extension operates by adding additional parameters to the [table id=NN /] shortcode. For a list of the provided parameters and their meanings, see the source file tablepress-pods.php. For it to be useful, you then need to go to the table definition (in the Tablepress tabs from the Dashboard) of the corresponding table and use Pods "magic tags" within that table.

Here's a brief example:

[table id=2 pod_name="problem" /]

together with a definition of table 2 in Tablepress that looks like

A B
1 Number Title
2 {@number} <a href="{@permalink}">{@title}</a>

will produce a two-column table that lists the number and title of each "problem" in the Pod, with the title being a link to the problem.

Note that the {}-expressions allowed in the entries of the table definition include arbitrary Pods "magic tags" syntax. So for example in my installation, which categorizes articles from a periodical, I have such expressions as {@issue.issue_number} and {@section.permalink}. You can also use the custom postprocessing argument, e.g. {@source, list_of_links_to_terms} (where "list_of_links_to_terms" is defined in the functions.php of my theme).

Troubleshooting

If you experience the symptom that the displayed table in your page won't update if you change the data in the Pod that it is reading from, unless you visit the table in Tablepress and re-save it, try adding cache_table_output=false to the shortcode that is displaying your table. (Thanks to ezolboo for this information.)

Building

To produce an installable zip file, assuming you have cloned this repository:

  1. Make sure that you have committed your changes with an update to the Version parameter in tablepress-pods.php.
  2. Make sure the current git head is on the commit you want to build.
  3. From the top-level directory of the repository, execute bash mkplugin.sh.