I am using the action restrict_manage_posts
to create a custom filter for my posts:
add_action( 'restrict_manage_posts', '_s_custom_filter' );
function kiewit_locations_custom_filter($post_type){
if ($post_type === 'custom_post_type'){
$args = array(
'post_type' => 'custom_post_type',
'parent' => 0
);
$items = get_pages( $args );
?>
<select id="filter_by_custom_post_type" name="filter_by_custom_post_type">
<option value=""><?php _e('All Custom Posts', '_s'); ?></option>
<?php
$current_v = isset($_GET['filter_by_custom_post_type']) ? $_GET['filter_by_custom_post_type'] : '';
foreach( $items as $item ) {
printf
(
'<option value="%s"%s>%s</option>',
$item->post_name,
$item->post_name == $current_v? ' selected="selected"':'',
$item->post_title
);
}
?>
</select>
<?php
}
}
I also have custom columns set up on my custom_post_type
to display selected meta data from a select
field and try to display that data using get_field_object('custom_select_information');
, however, that always returns false, even if I use the field key.
Any ideas how to get that custom_select_information
to display when filtering my posts?