ulc_codes_group_row
Filters the row content for a codes group before it's displayed, allowing modification of the row and group data.
add_filter( 'ulc_codes_group_row', $callback, 10, 2 );
Description
Fired after a table row for a codes group is generated, before it's outputted. Developers can modify the entire HTML row content or target specific column data for customization. The `$group` parameter provides access to the current group's data for conditional logic.
Usage
add_filter( 'ulc_codes_group_row', 'your_function_name', 10, 2 );
Parameters
-
$row(mixed) - This parameter contains the HTML for a single row in the groups table, which can be modified by other filters.
-
$group(mixed) - This parameter contains the HTML markup for a single row of the table, which can be modified by filters.
Return Value
The filtered value.
Examples
add_filter( 'ulc_codes_group_row', 'my_custom_codes_group_row_output', 10, 2 );
/**
* Adds custom HTML to the end of each group row in the Ultimate Dashboard Codes table.
*
* @param string $row The current HTML for the group row.
* @param object $group The group object being processed.
* @return string The modified HTML for the group row.
*/
function my_custom_codes_group_row_output( $row, $group ) {
// Let's say we want to add a small note about the group's creation date if available.
if ( isset( $group->date_created ) && ! empty( $group->date_created ) ) {
$creation_date = date_i18n( get_option( 'date_format' ), strtotime( $group->date_created ) );
$row .= '<td colspan="2" style="font-size: 0.8em; color: grey; text-align: center;">Created on: ' . esc_html( $creation_date ) . '</td>';
}
return $row;
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/classes/admin/class-view-groups.php:260
default:
$row .= apply_filters( 'ulc_codes_group_row_' . $column_name, $row, $group );
break;
}
$row .= '</td>';
}
$row = apply_filters( 'ulc_codes_group_row', $row, $group );
$row .= '</tr>';
return $row;
}
/**
* Override the display method to show only table content (no navigation)