Site logo

[Resolved] Sticky ads to the right of the body

Home Forums Support [Resolved] Sticky ads to the right of the body

Home Forums Support Sticky ads to the right of the body

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2553127
    dong hyeok choi

    I want to use a fixed vertical ad that is separated to the right of the body.

    You can do that by using the sidebar widget, but when a separated container is applied, the header and footer layouts are all separated, which is not what I want.

    I want to leave the layout I am currently using in my WordPress and place only one ad on the right side!

    Ads that only appear on desktop, such as AdSense siderail ads.

    The side rail floats on both sides of the main body, and I don’t like it because it floats small.

    #2553329
    David
    Staff
    Customer Support

    Hi there,

    this kind of thing is best managed by the advert provider.
    But if you can share a link to your site ill see if we have an option

    #2553872
    dong hyeok choi

    hi

    Added site address. can you help

    #2553999
    David
    Staff
    Customer Support

    OK.

    1. in Appearance > GeneratePress activate the Elements module.
    2. in Appearance > Elements, create a new Hook Element.
    3.1 inside the hook add this HTML with your advert code inside:

    <div class="aside-float-wrap">
    
    your advert code
    
    </div>

    3.2 Set the Hook to wp_footer
    3.3 Set the Display Rules to the Entire Site.
    3.4 Publish the hook.

    This will add the container and code at the bottom of your page.

    4. Now add this CSS to fix its position to the right of the screen:

    @media(min-width: 1280px) {
      .aside-float-wrap {
        --container-width: 800px;
        --wrap-width: 240px;
        position: fixed;
        top: 0;
        right: calc( ( 100vw - var(--container-width) ) / 2  - var(--wrap-width) );
       }  
    }

    Note that the @media min width is 1280px, Which is wrap-width + container-width + wrap-width
    So it only fixes its position if the screen is wide enough.

    Not sure what you want it to do on smaller screens, it could be hidden with CSS.

    #2554529
    dong hyeok choi

    Thank you, but there are no ads at all. When you enter Chrome guest mode, ads appear at the bottom of the site. What’s the matter?

    #2554612
    Ying
    Staff
    Customer Support

    How did you add the CSS from David’s step 4? I’m not seeing it in the additional CSS area in customizer.

    Let me know!

    #2554861
    dong hyeok choi

    Customize – Added CSS / I pasted the code here verbatim. There is code at the bottom of the additional css.

    #2555241
    David
    Staff
    Customer Support

    You need to clear the WP Rocket caches as the CSS isn’t loading.

    #2555685
    dong hyeok choi

    I turned off the rocket and tried various things, but it didn’t work. I think it would be better to just use the sidebar function, but can you help the separated container function to apply only the sidebar?

    #2555709
    Ying
    Staff
    Customer Support

    As David mentioned here:https://generatepress.com/forums/topic/sticky-ads-to-the-right-of-the-body/#post-2553329

    this kind of thing is best managed by the advert provider.
    But if you can share a link to your site ill see if we have an option

    If you can not get our solution to work properly due to the cache issue, I would recommend reaching out to your ads provider for a solution in this case.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.