- This topic has 17 replies, 3 voices, and was last updated 3 years, 2 months ago by
David.
-
AuthorPosts
-
November 3, 2019 at 8:50 am #1052121
Junaid
Hello there,
I want to add my Adsense auto ads code to my AMP version of the site. Please help me to insert auto ads code to AMP version of the site.November 3, 2019 at 8:45 pm #1052501Tom
Lead DeveloperLead DeveloperHi there,
This depends on where you want to add it.
You can use a widget in Appearance > Widgets.
You can also use a Hook Elements in our Elements module: https://docs.generatepress.com/article/hooks-element-overview/
Hope this helps 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentNovember 3, 2019 at 8:59 pm #1052508Junaid
Tom,
Thank you for your wonderful support. I want to add one code to header of AMP and the other in the body of the AMP version. Can you please guide me in this regard?November 3, 2019 at 9:01 pm #1052509Junaid
Kindly be specidic in this regard, so that I could easily add codes before </head> and before </body> tags.
November 4, 2019 at 4:59 am #1052688David
StaffCustomer SupportHi there,
in the Hook Element you can choose the following hooks:
WP_head – this is inside the
<head></head>
WP_footer – this appears close to the</body>
Each hook can be given a priority. A low number (1) places the code first, a higher number moves it down the stack. So a higher priority number is required to move it closer to the
</head>
or</body>
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 4, 2019 at 5:38 am #1052709Junaid
I will try it. Will it add code to my AMP version of the site? I’m actually trying to add code to my AMP version of the site.
November 4, 2019 at 5:41 am #1052711Junaid
I’m sorry but I couldn’t find any option for Hooks in my theme options. Where can I find it?
November 4, 2019 at 6:36 am #1052765David
StaffCustomer Supportin Appearance > GeneratePress activate the Elements module:
https://docs.generatepress.com/article/hooks-element-overview/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 4, 2019 at 6:38 am #1052767Junaid
Well, I got the Hook option. But can you please be specific how can I use this option to add code to AMP version of my site? There are options like,
Settings
Display rules
And in settings there are two options, execute PHP and Execute Shortcodes.November 4, 2019 at 6:42 am #1052774David
StaffCustomer SupportThe two hooks i provided are WP Hooks so should be available in the Amp pages as well.
To make it so it only appears on Amp pages would require the scripts to be wrapped in a Conditional code, which you would need to ask the Amp plugin author about.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 4, 2019 at 7:20 am #1052813Junaid
Thanks, I will try it and let’s see if it works.
November 4, 2019 at 7:21 am #1052816David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 4, 2019 at 10:31 am #1053064Junaid
I have placed the code but it’s not working. How can I check if the code is placed accurately?
November 4, 2019 at 10:56 am #1053096David
StaffCustomer SupportOn the desktop browser – right Click > Inspect. The Dev tools will open and you will see the DOM – expand the <head> and look for the scripts you added.
Make sure in the Hook Element you set the Display Rules to Entire site.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 4, 2019 at 9:11 pm #1053458Junaid
Yes, I had set for entire site and selected PHP execution.
-
AuthorPosts
- You must be logged in to reply to this topic.