Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Elana Davis

    (@elanasparkle)

    Hello @prash18,

    ​Thank you for reaching out to support! Yes, you can use something like the below hook to rename fields in Sprout Invoices.

    function si_change_strings( $translations, $text, $domain ) {
    	if ( 'sprout-invoices' === $domain ) {
    		// Change "QTY"
    		if ( 'Qty' === strtolower( $text ) ) {
    			return 'Days';
    		}
    		// add more conditions, changing as many strings as you'd like
    	}
    	return $translations;
    }
    add_filter( 'gettext', 'si_change_strings', 10, 3 );

    To add a hook you can use a plugin called snippet or you can put this in your active themes functions.php file. By going into your WordPress admin and going to Appearance -> Theme Editor and clicking on theme functions on the right and adding it past the <?php part in that file.

    Thanks
    Elana D.

    Thread Starter Prashant

    (@prash18)

    This gives me this error :

    Don't Panic
    
    The code snippet you are trying to save produced a fatal error on line 2:
    
    syntax error, unexpected '&'
    The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.
    
    Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
    Plugin Contributor Elana Davis

    (@elanasparkle)

    Hello @prash18,

    It could be how it is getting pasted into the editor from here. You might need to put it in a notepad beforehand and then paste it into your functions.php. Also, make sure it is not pasted into other parts of a different function.

    Thanks
    Elana D.

    Thread Starter Prashant

    (@prash18)

    I did it using notepad as too said. It didn’t show any error but it didn’t change Qty to Days. It still showing QTY

    Plugin Contributor Elana Davis

    (@elanasparkle)

    Hello @prash18,

    IF the above didn’t work you can try to use

    function si_change_strings( $translations, $text, $domain ) {
    	if ( 'sprout-invoices' === $domain ) {
    		$translations = str_replace( 'Qty', 'Days', $translations );
    	}
    	return $translations;
    }
    add_filter( 'gettext', 'si_change_strings', 10, 3 );

    Let us know if you are still having problems. I’m going to mark this as resolved for now and let us know if you need any further assistance.

    Thanks
    Elana D.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Rename column’ is closed to new replies.