- This topic has 19 replies, 3 voices, and was last updated 5 years, 5 months ago by
David.
-
AuthorPosts
-
November 25, 2020 at 7:30 am #1546476
David
StaffCustomer Supportoooh … ok – its never a good idea to edit the parent theme files, aside of things going a bit weird any changes you make will be overwritten when the theme is updated.
Could you remove those changes ?
We can help with adding the code without editing theme files afterwards 🙂
November 25, 2020 at 7:40 am #1546490Violeta
Both removed and it looks like that was a problem.
As I said I’m pretty new to WP, but on my previous site that I ran on a different theme I used theme editor to add codes.
Anyways, I am so happy we found the problem.:)
I guess I will activate my plugins now. And can you please help me to add the codes for Google Analytics and Skimlinks back? As well, I would like to know how to add codes without editing the theme for the future.
November 25, 2020 at 7:51 am #1546516David
StaffCustomer SupportPhew…. glad that resolved it – And no problems, theres a lot of nuances with WP and different Themes 🙂
Yep, you can re-activate your plugins.
Ok adding code to the themes templates such as the Header or the Footer, you can use the Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
1. Go to Appearance > Elements.
2. Create a new Hook element
3. Insert your code
4. Select the Hook where you need to add the code, options:a.
wp_head– insert inside the<header>tags
b.wp_footer– insert into footer – immediately before the closing</body>tag
c.wp_body_open– insert immediately after the opening<body>tag5. Set the elements Display Rule Locations to
Entire SiteI would recommend creating a separate Hook for each script you want to add, even if they are using the same hook, makes it easier to debug if one code is not working.
For other codes like PHP snippets, that you may be tempted to add to the themes functions.php, we explain how in this article:
https://docs.generatepress.com/article/adding-php/
CSS best place for it unless you’re adding a lot ( 100’s of lines ) is in the Customizer > Additional CSS. You may find some already in there that came with the Site Library import
November 25, 2020 at 9:45 am #1546768Violeta
David, all done. Codes have been added to the hook elements.
Thank you so much for all of your help!
November 26, 2020 at 2:33 am #1549054David
StaffCustomer SupportHappy to be of help!
-
AuthorPosts
- You must be logged in to reply to this topic.