Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #635405

    Hi Kriesi Team

    I want to add a custum code to a button, I did find some usefull information about it (http://kriesi.at/documentation/enfold/add-onclick-event-to-the-contact-form-submit-button/)

    I have a simple question, where exactly in the functions.php file do I add that code?

    Thanx
    Dylan

    #635441

    Hey studiopolak2!

    You can find the functions.php file from
    Appearance -> Editor and you can add the code to the end of the file, that will work.

    Please let us know if we can do anything else

    Regards,
    Basilis

    #635555

    Oh damn

    I paste the code and on a refresh, this is what I see, the whole website is not visible either:

    Parse error: syntax error, unexpected ‘ga’ (T_STRING) in /home/pxef341418/domains/interxion-ams8.nl/public_html/wp-content/themes/enfold/functions.php on line 524

    #635556

    Everything is back to normal, I deleted the code in the functions.php directly via the FTP,

    But since something is going wrong, could you explain to me what I did wrong?

    this is the code:

    onClick=”ga(‘send’, ‘event’, ‘Download’, ‘Download ams8 factsheet’);”

    So I added this as following:

    add_filter(‘avf_contact_form_submit_button_attr’,’avia_add_submit_attributes_to_cf’, 10, 3);
    function avia_add_submit_attributes_to_cf($att, $formID, $form_params){
    $att = “onClick=”ga(‘send’, ‘event’, ‘Download’, ‘Download campus factsheet’);””;
    return $att;
    }

    Then I copied that code at the end of the functions.php in the appearance>editor.

    What went wrong?

    • This reply was modified 7 years, 10 months ago by studiopolak2.
    #635572

    Hi,

    Place your script under the comment //add jQuery your script here

    function custom_func(){
    ?>
    <script>
    jQuery(window).load(function(){	
    
    // Add your jQuery script here
    
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_func');

    Best regards,
    Vinay

    #635581

    Hi Vinay

    Thanx for the quick reply

    So the whole script? Like this:

    function custom_func(){
    ?>
    <script>
    jQuery(window).load(function(){

    // Add your jQuery script here

    add_filter(‘avf_contact_form_submit_button_attr’,’avia_add_submit_attributes_to_cf’, 10, 3);
    function avia_add_submit_attributes_to_cf($att, $formID, $form_params){
    $att = “onClick=”ga(‘send’, ‘event’, ‘Download’, ‘Download campus factsheet’);””;
    return $att;
    }

    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘custom_func’);

    And where should I add this? at the end of the functions.php?

    #635928

    Hi,

    You can add the code to bottom of functions.php file in Appearance > Editor

    Best regards,
    Yigit

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.