bobbingwide / oik

OIK Information Kit
https://www.oik-plugins.com/oik-plugins/oik
GNU General Public License v2.0
2 stars 0 forks source link

Add totals= parameter to the [bw_table] shortcode #145

Open bobbingwide opened 4 years ago

bobbingwide commented 4 years ago

Similar to bobbingwide/oik-bob-bing-wide/issues/32 I want to be able to use the totals= parameter on the [bw_table] shortcode to be able to perform counts and sums of columns in a table.

Example:

[bw_table post_type=oik-plugins posts_per_page=100
 fields=title,blocks_catalogued,_oikp_block_count 
totals=c,t,t prefixes="Count:,Catalogued:,Delivered:"]

Ideally this functionality would also be available in any block that invokes the [bw_table] shortcode. This can come later.

I'm not yet bothered about what happens if the table is paginated.

bobbingwide commented 4 years ago

I'm not yet bothered about what happens if the table is paginated.

In the current implementation the totals apply to the rows actually displayed.

bobbingwide commented 2 years ago

The logic works for the shortcode but doesn't work in the Dynamic Content block. As soon as you attempt to add another parameter into the parameters field the [bw_table] shortcode reverts to displaying the default fields.

<!-- wp:oik/content-block {"shortcode":"bw_table",
"parameters":"fields=\u0022title,_oikth_template,_oikth_templates_count,_oikth_parts_count,_oikth_patterns_count,_oikth_type\u0022",
"post_type":"oik-themes","numberposts":70,"orderby":"title","order":"asc","format":""} /-->