Add filtering for Custom Column
Hi,
I downloaded the starter kit to add a custom column on custom post type overview.
The returned value is the post count of a WP Query:
[code]
public function get_raw_value($post_id) {
// put all the column logic here to retrieve the value you need
// For example: $value = get_post_meta( $post_id, '_my_custom_field_example', true );
$academicYear = academicYear();
$args = array(
'numberposts' => -1,
'post_type' => 'erp_gdp',
'meta_query' => array(
array(
'key' => 'gdp_eleve',
'compare' => '=',
'value' => $post_id
),
array(
'key' => 'gdp_annee_academique',
'compare' => '=',
'value' => $academicYear
)
)
);
$query = new WP_Query($args);
$value = $query->post_count;
return $value;
}
[/code]
Currently, the column displays the number of services for each members form the current academic year (2018-2019).
Each service is associated to a member and an academic year.
I would like to add a filering dropdown for this custom column to display the number of services from another academic year. (eg. 2017-2018) and change the returned value of get_raw_value function.
I find this post :
but no solution for my situation.
Thanks for your answer.
Tom
You must be logged in to reply to this topic.