PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Language - trying to use filters in functions.php

  1. I need to change the language from English to Norwegian in a form I am working on.

    I have tried to do so by using the filters that I found on the Gravity Forms website.

    I added the following code to the functions.php file:

    <?php
    add_filter("gform_product_price", "set_price_label", 10, 2);
    function set_price_label($sublabel, $form_id){
    return "Pris:";
    }
    ?>

    When saving the file and viewing the results, the website looks good. The change is made...

    However, next time I log into the Wordpress I get the white screen of death.

    I then have to replace the modified funcions.php file with the original one, and the WP dashboard returns to normal again.

    What am I doing wrong?

    The file looks like this:

    http://pastie.org/5500046

    Posted 9 years ago on Saturday December 8, 2012 | Permalink
  2. Richard Vav
    Administrator

    Your not necessarily doing anything wrong, but there are some themes and theme frameworks that don't like the functions.php file being modified. I would recommend you put any custom functions in a separate file from the theme, that way if you change themes or your theme gets an update your changes won't be lost.

    1. Create a new folder inside the /wp-content/ folder called mu-plugins
    2. Inside /wp-content/mu-plugins/ create a new file called custom-gravity-forms-functions.php
    3. Paste the contents of this http://pastie.org/5505551 into the file and save

    That's all you have to do, in wp-admin's list of installed plugins you will have a new group called 'must-use' which is where your new plugin will be listed, because it is in the must-use directory the plugin will automatically be enabled.

    Posted 9 years ago on Monday December 10, 2012 | Permalink