Created
April 8, 2015 23:41
-
-
Save secretstache/fe11521765e991131995 to your computer and use it in GitHub Desktop.
Append ACF Post Object to Admin Column Pro Filter Dropdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter the Admin Column results | |
* | |
*/ | |
function my_cac_filtering_options_change_acf_label( $options, $column ) { | |
$column_type = 'column-acf_field'; // enter type of field. You can find this by hovering of the Type label of the column settings. | |
$field_label = 'Product Class'; // enter label of the ACF field. | |
//if ( $column_type == $column->get_type() && $acf_field_type == $column->get_field_type() ) { | |
if ( $column_type == $column->get_type() ) { | |
$field = $column->get_field(); | |
if ( $field_label == $field['label'] ) { | |
foreach ( $options as $key => $label ) { | |
$industry_id = get_field('industry', $key); | |
$industry = get_the_title($industry_id); | |
$options[ $key ] = $label . ' — ' . $industry; | |
} | |
} | |
} | |
return $options; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment