sai.susarla
Forum Replies Created
-
Oops! I just realized that I had added that ‘data’ label support myself to the vanilla wp-table-reloaded plugin.
So my request is, could you please add the following support to wp-table-reloaded (modifying it as appropriate to suit your style)?
I wanted to add the ability to set the table data to the contents of an array supplied at runtime. To do so, I did the following:
Created a custom directory called wp-table-reloaded-custom under plugins.
Created a file called my-functions.php with the following content:
[Code moderated as per the Forum Rules. Please use the pastebin]
Made the following three modifications to controllers/controller-frontend.php:
Around line 15 (after “require_once(… base controller class …):
$custom_functions = WP_TABLE_RELOADED_ABSPATH . '../wp-table-reloaded-custom/my-functions.php'; if (file_exists($custom_functions)) { include_once($custom_functions); }Around line 209, after
$table = $this->load_table( $table_id ); Added the following line: $table['data'] = apply_filters( 'wp_table_reloaded_fetch_data', $table['data'], $atts );That’s it.
It really helps if we generate table content dynamically but still want to use the power of wp-table-reloaded with all its beautiful way of rendering tables.I’d really appreciate it if this type of functionality is added to a future version of this awesome plugin.
– Sai.[Please post code snippets between backticks or use the code button.]