Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author osdwebdev

    (@osdwebdev)

    Currently to change the submit button text you can do something like this:

    function mc_add_preset_field($submit) {
    	$submit = str_replace("Submit", "My Text", $submit);
        return $submit;
    }
    add_filter('osd_mc_forms_1', 'mc_add_preset_field', 10, 1);

    And to add it to all of your forms you just keep adding on the filter again like so:

    function mc_add_preset_field($submit) {
    	$submit = str_replace("Submit", "My Text", $submit);
        return $submit;
    }
    add_filter('osd_mc_forms_1', 'mc_add_preset_field', 10, 1);
    add_filter('osd_mc_forms_2', 'mc_add_preset_field', 10, 1);
    add_filter('osd_mc_forms_3', 'mc_add_preset_field', 10, 1);
    add_filter('osd_mc_forms_4', 'mc_add_preset_field', 10, 1);
    add_filter('osd_mc_forms_5', 'mc_add_preset_field', 10, 1);
    Plugin Author osdwebdev

    (@osdwebdev)

    You will want to change the name of that function to some thing like mc_change_submit_text

    function mc_change_submit_text($submit) {
    	$submit = str_replace("Submit", "My Text", $submit);
        return $submit;
    }
    add_filter('osd_mc_forms_1', 'mc_change_submit_text', 10, 1);
    Thread Starter paulotebet

    (@paulotebet-1)

    Thanks a lot.

    In order to make this things easier on endusers and save you some time ?? I would suggest you to include this in the backend, so Users could change this from the UI.

    This way you would broaden the type of user that will choose your plugin over others. But again, I understand that the plugin is in it’s beginning of life…

    Regards,

    Paulo Tebet

    Thread Starter paulotebet

    (@paulotebet-1)

    Looks like I am having some issues editing the functions.php file.

    This time, also when I included my code the site doesn’t load anymore…

    <?php

    // =============================================================================
    // FUNCTIONS.PHP
    // —————————————————————————–
    // Overwrite or add your own custom functions to X in this file.
    // =============================================================================

    function mc_change_submit_text($submit) {
    $submit = str_replace(“Submit”, “Inscrever-se”, $submit);
    return $submit;
    }
    add_filter(‘osd_mc_forms_1’, ‘mc_change_submit_text’, 10, 1);
    add_filter(‘osd_mc_forms_2’, ‘mc_change_submit_text’, 10, 1);
    add_filter(‘osd_mc_forms_3’, ‘mc_change_submit_text’, 10, 1);
    add_filter(‘osd_mc_forms_4’, ‘mc_change_submit_text’, 10, 1);

    Regards,

    Paulo

    Plugin Author osdwebdev

    (@osdwebdev)

    The second single quote on add_filter(‘osd_mc_forms_2’ <- needs to be a normal single quote. On 2, 3, 4 they all have a right single quote instead of a straight single quote. Use ‘ versus ’

    add_filter('osd_mc_forms_2', 'mc_change_submit_text', 10, 1);
    add_filter('osd_mc_forms_3', 'mc_change_submit_text', 10, 1);
    add_filter('osd_mc_forms_4', 'mc_change_submit_text', 10, 1);

    should fix it

    Thread Starter paulotebet

    (@paulotebet-1)

    Thanks a lot.

    Almost there….

    Now with both code below the site loads, but the Submit button is showing “0” as the label…

    Here is the current code in functions.php:

    function mc_add_preset_field_casar($fields) {
    $fields .= “<input type=’hidden’ value=’Vou Me Casar’ name=’fields[SILO]’>”;
    return $fields;
    }
    add_filter(‘osd_mc_forms_1’, ‘mc_add_preset_field_casar’, 10, 1);

    function mc_add_preset_field_mae($fields) {
    $fields .= “<input type=’hidden’ value=’Vou Ser Mae’ name=’fields[SILO]’>”;
    return $fields;
    }
    add_filter(‘osd_mc_forms_2’, ‘mc_add_preset_field_mae’, 10, 1);

    function mc_add_preset_field_retratos($fields) {
    $fields .= “<input type=’hidden’ value=‘Retratos’ name=’fields[SILO]’>”;
    return $fields;
    }
    add_filter(‘osd_mc_forms_3’, ‘mc_add_preset_field_retratos’, 10, 1);

    function mc_add_preset_field_fotografia($fields) {
    $fields .= “<input type=’hidden’ value=‘Fotografia’ name=’fields[SILO]’>”;
    return $fields;
    }
    add_filter(‘osd_mc_forms_4’, ‘mc_add_preset_field_fotografia’, 10, 1);

    function mc_change_submit_text($submit) {
    $submit = str_replace(“Submit”, “Inscrever-se”, $submit);
    return $submit;
    }
    add_filter(‘osd_mc_forms_1’, ‘mc_change_submit_text’, 10, 1);
    add_filter(‘osd_mc_forms_2’, ‘mc_change_submit_text’, 10, 1);
    add_filter(‘osd_mc_forms_3’, ‘mc_change_submit_text’, 10, 1);
    add_filter(‘osd_mc_forms_4’, ‘mc_change_submit_text’, 10, 1);

    Plugin Author osdwebdev

    (@osdwebdev)

    It is the double quotes around the replacement text for the submit button. They need to be the straight double quote. like ” not ”

    here it is with the straight double quotes:

    function mc_change_submit_text($submit) {
        $submit = str_replace("Submit", "Inscrever-se", $submit);
        return $submit;
    }

    Did you imagine you would be editing php and writing WordPress filters? ??

    thanks -osd

    Thread Starter paulotebet

    (@paulotebet-1)

    PERFECT !!!

    Now everything is working!

    In fact, one of my selection plugin criteria (that I haven’t mentioned) was “I don’t want to touch any code…..”

    But since I could not find any that fulfil all my other needs, AND SPECIALLY because of your level of support, then I don’t mind get my hands dirty, digging into the code… ??

    My problem is that I don’t know enough to do it, but know enough to break it…. And even when I can make it, it took me waaaaay to long to get some simple code change done.

    But with proper instruction I can handle it… ??

    I would like to send you some of my thought before I write the review for your plugin. Is there any way that I can send you a private message?

    Regards,

    Paulo Tebet

    Plugin Author osdwebdev

    (@osdwebdev)

    no, problem.

    [email protected]

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How can I change the text for the submit button?’ is closed to new replies.