
-
AuthorPosts
-
May 19, 2016 at 6:50 pm #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
DylanMay 19, 2016 at 7:48 pm #635441Hey 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,
BasilisMay 19, 2016 at 9:44 pm #635555Oh 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
May 19, 2016 at 9:53 pm #635556Everything 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 8 years, 11 months ago by
studiopolak2.
May 19, 2016 at 10:20 pm #635572Hi,
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,
VinayMay 19, 2016 at 10:42 pm #635581Hi 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?
May 20, 2016 at 3:33 pm #635928 -
This reply was modified 8 years, 11 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.