Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #80174
    rkmoonak
    Member

    I tried to replace “Taxes” with “Service Fee” in one of plugin and added the following code in the end of theme’s function.php file.

    function my_em_text_rewrites($translation, $orig, $domain) {
    str_replace(‘Service Fee’,’Taxes’, $translation);
    return $translation;
    }
    add_action ( ‘gettext’, ‘my_em_text_rewrites’, 1, 3 );

    But it give me following error: Parse error: syntax error, unexpected ‘$translation’ (T_VARIABLE) in /home/eventslo/public_html/wp-content/themes/catch-flames/functions.php on line 281.

    Line 281 is return $translation;

    #80234
    Pratik
    Participant

    Hi @rkmoonak,
    It is really a bad idea to edit the core theme files. You will loose all the edited codes in next update. If you want to customize anything in the theme, then use child theme. For detailed instructions of child theme, you can visit this link.

    Now, for the code, use add the following function in your child theme’s function.php file

    /* Replacing Taxes with Service Fee */ 
    function my_em_text_rewrites($translation, $orig, $domain) {
    	str_replace('Service Fee','Taxes', $translation);
    	return $translation;
    }
    add_filter ( 'gettext', 'my_em_text_rewrites', 1, 3 );

    If this does not work, you will need to contact the plugin’s support as this is not in the theme scope.

    #80236
    Sakin
    Keymaster

    @Pratik: Thanks for your reply.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘function.php error’ is closed to new replies.