Tagged: x
-
AuthorPosts
-
November 28, 2016 at 11:16 pm #1274146
josephk99997ParticipantHi,
I added this code to the functions.php of the child theme:
// Add script to the footer
// =============================================================================function my_custom_footer_output(){?>
<script type=”text/javascript”>
var trackcmp_email = ”;
var trackcmp = document.createElement(“script”);
trackcmp.async = true;
trackcmp.type = ‘text/javascript’;
trackcmp.src = ‘//trackcmp.net/visit?actid=251724499&e=’+encodeURIComponent(trackcmp_email)+’&r=’+encodeURIComponent(document.referrer)+’&u=’+encodeURIComponent(window.location.href);
var trackcmp_s = document.getElementsByTagName(“script”);
if (trackcmp_s.length) {
trackcmp_s[0].parentNode.appendChild(trackcmp);
} else {
var trackcmp_h = document.getElementsByTagName(“head”);
trackcmp_h.length && trackcmp_h[0].appendChild(trackcmp);
}
</script><?php}
add_action(‘wp_footer’, ‘my_custom_footer_output’);
// =============================================================================Did I do it right? Or did am I supposed to add a ?> at the end?
November 28, 2016 at 11:17 pm #1274147
josephk99997ParticipantI get this error:
Parse error: syntax error, unexpected ‘}’ in /home/content/p3pnexwpnas14_data01/21/3063521/html/wp-content/themes/x-child/functions.php on line 48
November 28, 2016 at 11:20 pm #1274150
josephk99997ParticipantI can’t navigate anywhere on the wordpress admin now cos this error keeps coming up.
November 28, 2016 at 11:31 pm #1274160
josephk99997ParticipantMy website is totally down now http://www.cloudio.one
November 28, 2016 at 11:47 pm #1274171
PhotonicPRParticipantDelete the code from your custom child theme functions doc and the theme should reload.
November 29, 2016 at 12:39 am #1274217
josephk99997ParticipantSite back up again; code deleted. But still need to add that script to the footer. How do I proceed?
November 29, 2016 at 1:12 am #1274243
RupokMemberHi there,
You should have fixed that by following the error message. It seems you have placed an unwanted ending and curly brace
<?php}. Let’s remove this to get expected result.Thanks!
November 29, 2016 at 5:59 am #1274518
josephk99997ParticipantHere is the correct code:
// Add script to the footer
// =============================================================================function my_custom_footer_output() {
?><script type=”text/javascript”>
var trackcmp_email = ”;
var trackcmp = document.createElement(“script”);
trackcmp.async = true;
trackcmp.type = ‘text/javascript’;
trackcmp.src = ‘//trackcmp.net/visit?actid=251724499&e=’+encodeURIComponent(trackcmp_email)+’&r=’+encodeURIComponent(document.referrer)+’&u=’+encodeURIComponent(window.location.href);
var trackcmp_s = document.getElementsByTagName(“script”);
if (trackcmp_s.length) {
trackcmp_s[0].parentNode.appendChild(trackcmp);
} else {
var trackcmp_h = document.getElementsByTagName(“head”);
trackcmp_h.length && trackcmp_h[0].appendChild(trackcmp);
}
</script><?php
}add_action( ‘wp_footer’, ‘my_custom_footer_output’, 99999 );
?>
I will test later if the script is actually tracking anything and report back.
November 29, 2016 at 6:15 am #1274543
Paul RModeratorGlad to know you were able to figure it out. Have a nice day!
November 30, 2016 at 7:21 am #1275964
josephk99997ParticipantThe script is not tracking anything. I think the code I added is wrong.
Please let me know exactly how to add a script to the footer of every page while working within the child theme. thanks!
November 30, 2016 at 7:35 am #1275980
ChristianModeratorThe code was added successfully in your footer (see attachment). It might be a problem with your code. Please contact the code provider for further investigation.
Thanks.
November 30, 2016 at 8:54 am #1276047
josephk99997ParticipantYou’re absolutely 100% correct…thanks! All working perfectly now 🙂
November 30, 2016 at 9:14 am #1276070
ChristianModeratorYou’re welcome.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1274146 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
