Created
October 8, 2019 17:51
-
-
Save dancameron/14f0d0f491781b8d223320f86ffd211e to your computer and use it in GitHub Desktop.
Modifying Column Titles
This file contains hidden or 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 // don't include this line in your functions.php, since it already starts with it. | |
| function si_convert_perc_to_discount_column_label( $columns = array() ) { | |
| if ( is_admin() ) { | |
| return $columns; | |
| } | |
| $columns['rate']['label'] = 'Fee'; | |
| $columns['tax']['label'] = 'VAT'; | |
| $columns['total']['label'] = 'Total'; | |
| if ( ! is_admin() ) { | |
| unset( $columns['qty'] ); | |
| } | |
| return $columns; | |
| } | |
| add_filter( 'si_line_item_columns', 'si_convert_perc_to_discount_column_label' ); | |
| function si_change_strings( $translations, $text, $domain ) { | |
| if ( 'sprout-invoices' === $domain ) { | |
| // Change "Description" | |
| if ( 'Task' === $text ) { | |
| return 'Description'; | |
| } | |
| // add more conditions, changing as many strings as you'd like | |
| } | |
| return $translations; | |
| } | |
| add_filter( 'gettext', 'si_change_strings', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This snippet is a customization for Sprout Invoices. A customizable solution that provides a way for you to get paid via your WordPress site. For more information please don't hesitate to reach out.