Last active
January 8, 2019 18:05
-
-
Save altoin/89a6698a0141e662727146b1a40bce59 to your computer and use it in GitHub Desktop.
Rename filename when exporting CSV/ Excel using DataTables extensions in GravityView
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 | |
/* Rename the CSV filename.*/ | |
add_filter('gravityview/datatables/button_csv','gravityview_csv_export_settings', 10 ,2); | |
function gravityview_csv_export_settings( $button_config = array(), $view_id){ | |
if($view_id==19)/* You must pass a Valid View ID here for this to work*/ | |
{ | |
$button_config['filename'] = 'my_csv'; /*please change 'my_csv' to your preffered filename*/ | |
return $button_config; | |
} | |
} | |
/* Rename the Excel filename.*/ | |
add_filter('gravityview/datatables/button_excel','gravityview_excel_export_settings', 10 ,2); | |
function gravityview_excel_export_settings( $button_config = array(), $view_id){ | |
$button_config['filename'] = 'my_excel'; /*please change 'my_excel' to your preffered filename*/ | |
return $button_config; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment