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.

Problem changing sublabels through filter in Headway

  1. sammet
    Member

    Hi All!

    I am using Wordpress in English but I need my forms to be in Spanish. SInce I do not want to change the Wordpress language I am trying to use filters to change the sublabels as a way to change the language.

    However it does not work for me. Probably I am doing something wrong.

    I need to change the price and quantity labels and I would very much apreciate some help how to do it in Headway for ALL my forms.

    I have put the code in the custom_functions.php provided by Headway theme but the changes are not taking effect.

    I am using the follwoing code:

    add_filter("gform_product_price", "set_price_label", 10, 2);

    "set_price_label" is where I can change to spanish right?

    As you see I am sort of new to this and would very much apreciate a step-by-step instruction..;-)

    Thanks for help in advance!

    Best regards,
    Sammet

    Posted 12 years ago on Tuesday August 23, 2011 | Permalink
  2. No, "set_price_label" is not where you would set the spanish version. This is a filter, the filter would execute a function that returns the value. All the sub-labels are documented here:

    http://www.gravityhelp.com/documentation/page/Developer_Docs#Sublabels

    If you go to each one you will see there is an example on it's usage.

    Posted 12 years ago on Tuesday August 23, 2011 | Permalink
  3. sammet
    Member

    Hi again!

    Thanks for answering me. Unfortunately I still do not have a clue about how to make this work despite reading the information you linked to me.

    I am missing some some steps. Sorry.

    So in order to clarify: If I want ALL my forms and ALL sublabels of EVERY price fields to change from "Price" to "Cost"
    - How should I write the code?

    It would be nice to get some more specific information of each code example.... For example what are the number 10 and 2 refering to? Is it specific form fields?

    If so leaving the numbers out, would it make ALL price form fields taking on the return "Cost"?

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

    I have searched the Web your site and in order to find a more thourough tutorial on this topic but without any luck. Maybe you have other tutorials I have not been able to find?

    Thanks for help in advance!

    Sammet

    Posted 12 years ago on Wednesday August 24, 2011 | Permalink
  4. All you need to do is follow the examples. The 10,2 are part of the filter call. You shouldn't change them, they aren't options.

    First off the filter you are trying to use is only available in Gravity Forms v1.6 which is getting ready to be released. So that code isn't even going to work with the version you have. If you notice the link to that documentation said: http://i.imgur.com/2P4Ij.png

    If you were running Gravity Forms v1.6 however... the code you would use would be:

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

    That would change it for all Price fields that have this sublabel on all your forms. The _185 appended to the end of gform_product_price would only target form id 185.

    But as I mentioned, you don't have Gravity Forms v1.6 yet so that filter isn't going to do anything because it doesn't exist in the current public release.

    Posted 12 years ago on Wednesday August 24, 2011 | Permalink
  5. sammet
    Member

    Thanks for a very quick and promted answer!

    I just picked up the wrong field to test ,-) Now I tested the other codes and they are working perfectly! Great.

    Just another question related to language...

    Is it possible to change the name of the days and months in a calender?

    Also - is it possible to style the calender with CSS?
    If so - what are the selectors names?

    Best rergards,
    Sammet

    Posted 12 years ago on Thursday August 25, 2011 | Permalink
  6. The calendar (datepicker) is the jQuery UI Date Picker. It can be translated. See here:
    http://www.gravityhelp.com/forums/topic/localization-of-the-date-picker-and-date-format#post-3141

    Regarding styling it with CSS, you can read about that here:
    http://jqueryui.com/demos/datepicker/#theming

    Posted 12 years ago on Thursday August 25, 2011 | Permalink