- This topic has 15 replies, 3 voices, and was last updated 3 years, 9 months ago by
Leo.
-
AuthorPosts
-
February 26, 2020 at 2:39 pm #1178010
Patrik
Hi,
Im implementing a GDPR Cookie Concent plugin: secureprivacy.ai
Maybe good to know: Running WordfenceThey are telling me to add a script after the header section.
Im adding this to my header.php file following this guide:
https://knowledgebase.secureprivacy.ai/article/26-how-to-add-automated-blocking-script-on-your-website
But when i trying to enter my site it kind of “freezes” and the popup doesnt show.Should this be any issues? Im a editing the wrong file?
Many thanks,
PatrikFebruary 26, 2020 at 3:35 pm #1178028Vitor
Hi Patrik,
Don’t change internal Theme files they will be lost once you update the Theme when a new version is released.
You should use Hooks if you need to inject any third-party code on your project. https://docs.generatepress.com/article/hooks-element-overview/
February 26, 2020 at 5:02 pm #1178069Patrik
Many thanks,
Is it somehow possible to force it to appear directly after <head>?
So:
<!DOCTYPE html>
<html lang=”en-US”>
<head>
<script type=”text/javascript” src=”https://app.secureprivacy.ai/script/5e56ea……js”></script>
<meta charset=”UTF-8″>
<link rel=”profile” href=”https://gmpg.org/xfn/11″>
<title>Informator – Informator</title>February 26, 2020 at 5:18 pm #1178085Leo
StaffCustomer SupportHi there,
So you want that code to be at line 19 here?
https://www.screencast.com/t/pyr4PITNThere is no hook there unfortunately.
You can copy the file below and paste it into your child theme folder and add the code where desired:
https://github.com/tomusborne/generatepress/blob/master/header.phpLet me know if this helps 🙂
February 27, 2020 at 12:37 pm #1179041Patrik
Hi Leo,
Thank you!
Actually it must be here, its a cookie concent plugin and this scripts needs to be here so im 100% it auto disables all cookies and stuff automatically
Here: https://prnt.sc/r8p18vSo i really dumb question now, will this replace the active “website” somehow?
Should i search for a file called header.php?February 27, 2020 at 12:42 pm #1179046Leo
StaffCustomer SupportThat case the
wp_head
hook is what you need:
https://docs.generatepress.com/article/wp-head/What was the issue with that?
February 27, 2020 at 12:48 pm #1179051Patrik
Ill put it with the wp_head and you will see where it shows 🙂
give me 2 minFebruary 27, 2020 at 12:54 pm #1179057Leo
StaffCustomer SupportTry using priority 1 and see if that’s better.
February 27, 2020 at 12:59 pm #1179061Patrik
So i did this:
https://prnt.sc/r8p925
– Not quite sure why its red?Original script is wrote:
<script type=”text/javascript” src=”https://app.secureprivacy.ai/script/5e56ea……js”></script>And it ends up here, its at the end:
https://prnt.sc/r8pb9kFebruary 27, 2020 at 1:02 pm #1179070Leo
StaffCustomer SupportIs it the same if you use priority 1 in the hooks element?
If so you will need to copy the file below and paste it into your child theme folder and add the code where desired:
https://github.com/tomusborne/generatepress/blob/master/header.phpFebruary 27, 2020 at 1:06 pm #1179078Patrik
Yeah, sad it doesnt work because I dont know nothing about code haha!
Allright, so are you able to quickly tell me where your theme has child theme folder?And in that folder i place this php file?
Will this overwrite existing code and stuff?
Cause somehow i got bunch of code thereFebruary 27, 2020 at 1:08 pm #1179081Leo
StaffCustomer SupportYou will need to install a child theme:
https://docs.generatepress.com/article/using-child-theme/#installing-a-child-themeBy default there will be a
style.css
andfunction.php
in that folder.Then you will want to copy and paste this file:
https://github.com/tomusborne/generatepress/blob/master/header.phpAnd also name it
header.php
in the same folder.Then make the edit there.
February 27, 2020 at 1:11 pm #1179086Patrik
Thanks Leo,
Is the link for your documentation correct?
Because it seems like it not workingAlso seems like all profile pictures are gone here in forum
February 27, 2020 at 1:15 pm #1179093Leo
StaffCustomer SupportThat link is definitely correct:
https://www.screencast.com/t/LCHHegmmpAdHSounds like you are having some browser issue.
February 27, 2020 at 3:15 pm #1179165Patrik
Sorry, my ISP had as you sad technical problems.
So if i copy and paste that header.php will it overwrite all the other code? -
AuthorPosts
- You must be logged in to reply to this topic.