No, this is not yet supported. But you can get around it by hooking into any column with a filter to change the value output.
<?php
add_filter( 'yourpod_field_value', 'my_combine_fields', 10, 5 );
function my_combine_fields ( $value, $field, $attributes, $row, $obj ) {
if ( 'your_field' == $field ) {
$value .= ' ' . $row[ 'your_other_field' ];
}
return $value;
}
?>
Hi Scott,
Thanks for the answer and sorry for my late reply. I was on another project some days.
Every pods_ui wp-admin page has a Pod Search function. Can I get the search working on both the fields?
Thanks!
There’s documentation on Pods UI here: http://pods.io/docs/code/pods-ui/
You can set search_across and/or search_across_picks to true to search across all fields and relationship fields respectively.
Can you elaborate? I want to join fields first_name and last_name. How could I make them appear in the same (first) column?
Hi Gabe462,
As you can see, the code Scott already provided in this topic must be enough to accomplish this.
<?php
add_filter( 'yourpod_field_value', 'my_combine_fields', 10, 5 );
function my_combine_fields ( $value, $field, $attributes, $row, $obj ) {
if ( 'your_field' == $field ) {
$value .= ' ' . $row[ 'your_other_field' ];
}
return $value;
}
?>
OK, my first reply was inadequate.
What is ‘yourpod_field_value’? Are you saying that there is a hook created for every pod named ‘nameofpod_field_value’? I’ve not yet found a doc page for this…
Yep:)
Take a look at classes/PodsUI.php line 3329-332:
if ( is_object( $this->pod ) )
$row_value = $this->do_hook( $this->pod->pod . '_field_value', $row_value, $field, $attributes, $row );
$row_value = $this->do_hook( 'field_value', $row_value, $field, $attributes, $row );
Thanks for the pointer. I’m wondering if this is the wrong hook, because while I’ve set
add_filter( 'student_field_value', 'my_combine_fields', 10, 5);
my test is true:
has_filter( 'student_field_value', 'my_combine_fields' ) )
and my echo never prints
function my_combine_fields( $value, $field, $attributes, $row, $obj ) {
echo "<!-- my_combine_fields() -->";
if ( 'first_name' == $field ) {
$value .= ' ' . $row[ 'last_name' ];
}
return $value;
}
Any thoughts? Thanks much
The filters are all prefixed with pods_ui_, so that filter should be pods_ui_field_value
or pods_ui_{your_pod}_field_value
, sorry my original reply was incorrect.