uo_tincanny_reporting_questions_table_thead_beforeend
Fires after the table head in the Tincanny reporting questions table, allowing for custom content insertion.
add_action( 'uo_tincanny_reporting_questions_table_thead_beforeend', $callback, 10, 1 );
Description
Fires after the table headers for the Uncanny Toolkit's Question Analysis Report are rendered, but before the table body begins. Developers can use this hook to inject custom table header cells or modify the existing ones.
Usage
add_action( 'uo_tincanny_reporting_questions_table_thead_beforeend', 'your_function_name', 10, 1 );
Examples
/**
* Add a custom column header to the Uncanny Tincanny questions report table.
*
* This example demonstrates how to hook into 'uo_tincanny_reporting_questions_table_thead_beforeend'
* to add an extra table header cell to the questions report table.
*
* @param array $columns The existing columns for the table header. Not used in this example,
* but shown for completeness of understanding potential arguments.
*/
add_action( 'uo_tincanny_reporting_questions_table_thead_beforeend', function( $columns = [] ) {
// Add a new header for a custom metric, e.g., "Average Time Spent"
echo '<th class="report-header custom-average-time">' . esc_html__( 'Avg. Time Spent', 'your-text-domain' ) . '</th>';
}, 10, 1 ); // Priority 10, accepts 1 argument (though not strictly needed for this specific example)
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/uncanny-question-analysis-report/question-analysis-report.php:907
<tr>
<?php do_action( 'uo_tincanny_reporting_questions_table_thead_afterbegin' ); ?>
<?php foreach ( self::$columns as $id => $col ) { ?>
<th class="report-header <?php echo esc_attr( sanitize_title( $id ) ); ?>"><?php echo $col; ?></th>
<?php } ?>
<?php do_action( 'uo_tincanny_reporting_questions_table_thead_beforeend' ); ?>
</tr>
</thead>
<tbody>
<?php do_action( 'uo_tincanny_reporting_questions_table_tbody_afterbegin' ); ?>
<?php foreach ( $questions as $question ) { ?>