Skip to content

Instantly share code, notes, and snippets.

@sc0ttkclark
Created December 8, 2021 03:25
Show Gist options
  • Save sc0ttkclark/e085c1d1d4ea9be66bdee50ff7536b0e to your computer and use it in GitHub Desktop.
Save sc0ttkclark/e085c1d1d4ea9be66bdee50ff7536b0e to your computer and use it in GitHub Desktop.
Pods Pro - TablePress Integration - Customize column values using templates with magic tags
<?php
/**
* Customize column values using templates with magic tags
*
* @param array $custom_column_templates The list of custom column templates to be used, with the field name as the key.
* @param string $pod_name The pod name.
* @param Pods $pod The Pods object.
* @param array $params The Pods::find() parameters to be used.
* @param array $table The TablePress information.
* @param array $render_options The TablePress render options.
*
* @return array The list of custom column templates to be used, with the field name as the key.
*/
my_custom_pods_pro_tablepress_data_custom_column_templates( $custom_column_templates, $pod_name, $pod, $params, $table, $render_options ) {
// my_column_template would be a Pods Template with content like "<a href="{@website,esc_url}">The website</a>" in it.
$custom_column_templates['my_column'] = 'my_column_template';
return $custom_column_templates;
}
add_filter( 'pods_pro_tablepress_data_custom_column_templates', 'my_custom_pods_pro_tablepress_data_custom_column_templates', 10, 6 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment