Last active
December 19, 2015 07:39
-
-
Save sscovil/5919849 to your computer and use it in GitHub Desktop.
Example of how to add a header row to the table data array, using my CSV-to-SortTable plugin for WordPress. Add this to your `functions.php` file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* CSV to SortTable: Add Header Row | |
* | |
* @param array $data | |
* @return array | |
*/ | |
function csv_to_sorttable_add_header_row( $data ) { | |
$header_row = array( 'Column 1', 'Column 2', 'Column 3' ); | |
array_unshift( $data, $header_row ); | |
return $data; | |
} | |
add_filter( 'csv_to_sorttable_data_array', 'csv_to_sorttable_add_header_row' ); |
Thank you, very helpful when hootsuite scheduled messages downloads as a csv with no header row.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In response to support ticket: http://wordpress.org/support/topic/set-the-column-names-independently