Optimizing functions.php code

Home Forums Quform WordPress Optimizing functions.php code

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30324
    carlichy
    Participant

    I have used some different codes in the function.php following some of your tutorials and helps, but I would like to optimize them, I show you an example:

    I use this code to check the email field of my form in another email field:

    add_filter(‘quform_element_valid_1_17’, function ($valid, $value, Quform_Element_Field $element) {
    if ($valid && $value != $element->getForm()->getValue(‘quform_1_4’)) {
    $element->addError(‘the email doesn´t match’);
    $valid = false;
    }

    return $valid;
    }, 10, 3);

    But I have to clone this same code 7 times because I have 7 forms, ¿How can I optimize this code for 7 different forms using the same function (adding the field number in the same code)?

    Thanks

    #30353
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy