wpdatatables_add_class_to_table_html_element

Contents

Description

This filter is used to add custom classes to the table’s HTML element before it is rendered.

Usage

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
add_filter( 'wpdatatables_add_class_to_table_html_element', 'add_class_to_table_html_element', 10, 2 );
add_filter( 'wpdatatables_add_class_to_table_html_element', 'add_class_to_table_html_element', 10, 2 );
add_filter( 'wpdatatables_add_class_to_table_html_element', 'add_class_to_table_html_element', 10, 2 );

Parameters

  • $classes string
    String of classes.
  • $tableId integer
    ID of table from database.

Examples

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Callback function for the wpdatatables_add_class_to_table_html_element hook
function add_class_to_table_html_element( $classes, $tableId ) {
if ( $tableId == 1) {
// Your code
}
}
add_action( 'wpdatatables_add_class_to_table_html_element', 'add_class_to_table_html_element', 10, 2 );
// Callback function for the wpdatatables_add_class_to_table_html_element hook function add_class_to_table_html_element( $classes, $tableId ) { if ( $tableId == 1) { // Your code } } add_action( 'wpdatatables_add_class_to_table_html_element', 'add_class_to_table_html_element', 10, 2 );
// Callback function for the wpdatatables_add_class_to_table_html_element hook
function add_class_to_table_html_element( $classes, $tableId ) {

if ( $tableId == 1) {
// Your code
}

}

add_action( 'wpdatatables_add_class_to_table_html_element', 'add_class_to_table_html_element', 10, 2 );