add a piece of JS code to a specific post without using an untested plugin

Posted in: Newspaper
Post count: 18

Hi there,
I would like to add google ad sense code to a specific post of mine.
I do not wish to add it to the entire site. this is the code:

<script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: “ca-pub-XXXXXXXXXXXXX”,
enable_page_level_ads: true
});
</script>

Is there a way to add a piece of js code to a specific post without using an untested plugin?

Post count: 18

I saw this video now https://www.youtube.com/watch?v=yiv0M4zPmVg and I understood that there is a way to add it to a specific page, but I didn’t see a way to add it to a specific post…

Post count: 20688

Hi,

The theme panel post ads will be displayed for all the posts, there should be now way to show an ad for specific posts.

With the new features, that would be possible. Through the tagDiv Cloud library plugin you can import or create post templates. Ads fro these templates can be added in the composer directly
https://www.screencast.com/t/Y2nZwnHTTAUA
https://forum.tagdiv.com/tagdiv-cloud-library-plugin/
So you could create a post template or use a predefined post template in the Cloud library plugin, and enter the ads you want. Then apply that template specifically to the posts in which you want to display the ads. This could be a solution if you should consider it.

Thanks

Post count: 18

Hi Simion, Thank you.
It really looks like the best practice for what I need.
I have tried to follow the instructions, but I am encountering in many errors when installing the plugin, take a look:

Post count: 18

after the last error, it is just stuck, I tried removing and installing the plugin.

Post count: 20688

Hi,

I see you deactivated all the other plugins, so a plugin conflict is not the case. You could take a look at the theme system status panel
https://forum.tagdiv.com/requirements-for-newspaper/
Check if there is need for any modifications, if possible increase the WP-memory higher then the minimum recommended value. Check if this has any effect.
Also do a quick test with a different browser.

If there is still a problem, we could take a look. Send us an email at contact@tagdiv.com and provide admin login access. Also provide cPanel and FTP if possible. Include a link to this topic in the email.

Thanks

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.