guideplugin/result/template_data
Definition
With this filter you can adjust the data of a list in the Result Template.
Parameters
appy_filters('guideplugin/result/template_data', $data_values, $post_id, $data_source); appy_filters('guideplugin/result/template_data/{data_source}', $data_values, $post_id, $data_source);
$data_values
(array) Array of the data of this element.$post_id
(int) The Post ID.$data_source
(string) The data source.
Example
The example shows you how to add the suffix ‘Euro’ to the ACF field ‘price’.
<?php function my_guide_template_data($data_values, $post_id, $data_source) { // Only modify data 'acf_price' if ($data_source == 'acf_price') { if (count($data_values) > 0) { array_walk($data_values, function(&$value, $key) { $value .= ' Euro'; }); } } return $data_values; } add_filter('guideplugin/result/template_data', 'my_guide_template_data', 10, 3);
or
function my_guide_template_data_price($data_values, $post_id, $data_source) { // You don't need to check for 'acf_price' if (count($data_values) > 0) { array_walk($data_values, function(&$value, $key) { $value .= ' Euro'; }); } return $data_values; } add_filter('guideplugin/result/template_data/acf_price', 'my_guide_template_data_price', 10, 3);