Site logo

Archived topic

Show Google Adsense Code on Scroll

12 replies · Started by Sumit on October 18, 2018

Viewing posts 1–13 of 13

Can you please check the mentioned link on mobile, you will notice Adsense code slide down. How I can implement that using generate press?

Also, I wanted to know. what is the way for me to show google ads code inside the post content both on mobile and desktop? I am sorry if these are noob questions.

Thank You.

Thank you.

What is the difference between before content and before main content in this snapshot?

http://prntscr.com/l7zy96

I am trying to setup adsense ad once before the actual blog post content starts and once the blog post ends.

you can check what I am trying to do by visiting any post I mentioned as website link.

Thanks

before_content is directly before the page title on the page.

before_main_content is before the <main> element on the page, which is higher up in the HTML.

It sounds like you want before_content and after_content.

Thank You. I will test it out.

Is it further possible to add device type restriction to hooks?

Because I want to be able to add different Adsense code for mobile device and not show the desktop Adsense code on mobile.

One more question I have is (please visit any blog post.)

You will notice inside of the blog post there is a "Sponsored Links" section shows twice inside of blog post (it is a custom code). Can I achieve same functionalities using GeneratePress?

Thank you.

btw that before and after content seems to have not fix the problem for me. I am seeing add before post starts (including dealing and featured image, right on top of both). And below the tags and and category section.

I want it right before where the post content start and right after the post content ends.

You can add mobile/desktop stuff within the same hook like this:

<div class="hide-on-desktop">
    Hidden on desktop stuff in here
</div>

<div class="hide-on-tablet">
    Hidden on tablet stuff in here
</div>

<div class="hide-on-mobile">
    Hidden on mobile stuff in here
</div>

To reach those specific areas, you'd need to use a plugin like this: https://wordpress.org/plugins/ad-inserter/

Thanks Tom.

Would have been great if GeneratePress could specify the location, now to add ads I have to use a whole other plugin. #wordpresslife

I'm not a huge fan of filtering the content, which is what's necessary to do what you're doing.

I'll definitely keep it in mind though :)

Thanks, ad inserter worked like a charm btw.

Awesome :)

This archived topic is closed to new replies.