-
AuthorPosts
-
October 13, 2014 at 7:15 pm #335126
Hi guys,
I just signed up for an exit-intent popup solution. The installation instructions are to “Place this javascript code snippet in the <head> tag of the page.”. What is best practice for installing this within enfold?
Thanks!
Best,
JonathanOctober 15, 2014 at 3:49 pm #336187Hey Jonathan!
Please go to Appearance > Editor and open Header.php file and place inside <head> tags
Cheers!
YigitOctober 16, 2014 at 1:57 am #336486Thanks! It looked more difficult online when searching as there were things about hooks and such. No chance that this will break anything? Or is it best to use a plugin to insert headers?
October 16, 2014 at 6:56 am #336560Hey!
You can use the wp_head action hook if you don’t want to edit header.php file. http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head
Something like this:
function add_custom_script(){ ?> <script> SCRIPT HERE </script> <?php } add_action('wp_head', 'add_custom_script', 10);Cheers!
IsmaelOctober 16, 2014 at 7:07 am #336565Oh ok so I can just insert this into custom.css instead of modifying the header.php file?
October 16, 2014 at 8:59 am #336634Hey!
You can add it on Appearance > Editor > functions.php file. Place it at the very bottom. Replace this line with your own script:
<script> SCRIPT HERE </script>Regards,
IsmaelOctober 16, 2014 at 4:42 pm #336886Ok, thank you. I apologize for all the questions.
Last thing I’m curious about – I don’t understand which way is better, to insert the script directly into the header.php file or to use the hook? If they both accomplish the same thing. Am I right in assuming that if I’m not using a child theme then just insert into header.php and keep a log of my edit to repeat on theme updates, and if I’m using a child theme then the hook is the way to go?
Thanks again for all your assistance.
Best,
JonathanOctober 17, 2014 at 6:41 am #337178Hi!
Both is good but using the hook is update proof. Just add it on the child theme’s functions.php.
Cheers!
IsmaelOctober 17, 2014 at 4:02 pm #337409Ok perfect, thank you!
-
AuthorPosts
- The topic ‘Code in tag’ is closed to new replies.
