cac/addon/filtering/dropdown_top_label

Deprecated This documentation is deprecated since Admin Columns version 4.

Filter cac/addon/filtering/dropdown_top_label.

Usage

Filters the top label of the filtering dropdown on the listings screen.

/**
 * Filtering: Change top label of the dropdown
 *
 * @param atring $label Column Label
 * @param object $column CPAC_Column object
 * @return string Column Label
 */
function my_filtering_dropdown_top_label( $label, $column ) {
	
	// Possibly modify $label
	return $label;
}
add_filter( 'cac/addon/filtering/dropdown_top_label', 'my_filtering_dropdown_top_label', 10, 2 );

Example

To use this example, just place it in your theme’s functions.php.

Change the top label for custom taxonomies (taxonomy column)

Use this code to change the top label of the filtering dropdown for your custom taxonomy from “All my_taxonomy” to “All available my_taxonomy terms!”.

/**
 * Example: This will change the top label from "All my_taxonomy" to "All available my_taxonomy terms!".
 *
 */
function my_filtering_change_dropdown_top_label_taxonomy( $label, $column ) {
	$column_type = 'column-taxonomy'; // enter type of field. You can find this by hovering of the Type label of the column settings.
	$taxonomy = 'my_taxonomy';  // The taxonomy you like to target
	if ( $column_type == $column->get_type() && $taxonomy == $column->get_taxonomy() ) {
		$label = 'All available ' . $taxonomy . 'terms !';
	}
	return $label;
}
add_filter( 'cac/addon/filtering/dropdown_top_label', 'my_filtering_change_dropdown_top_label_taxonomy', 10, 2 );


Change the top label for custom fields (custom field column)

Use this code to change the top label of the filtering dropdown for custom fields.

/**
 * Example: This will change the top label for Custom Fields.
 *
 */
function my_filtering_change_dropdown_top_label_custom_field( $label, $column ) {
	$custom_field = 'my_custom_field'; // enter your custom field key
	$column_type = 'column-meta';  // enter type of field. You can find this by hovering of the Type label of the column settings.
	if ( $column_type == $column->get_type() && $custom_field == $column->get_field() ) {
		$label = 'All filtering dropdown options for my field!';
	}
	return $label;
}
add_filter( 'cac/addon/filtering/dropdown_top_label', 'my_filtering_change_dropdown_top_label_custom_field', 10, 2 );