- This topic has 9 replies, 3 voices, and was last updated 3 years, 3 months ago by
Ying.
-
AuthorPosts
-
March 2, 2023 at 10:42 am #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.
March 2, 2023 at 2:01 pm #2553329David
StaffCustomer SupportHi 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 optionMarch 3, 2023 at 4:07 am #2553872dong hyeok choi
hi
Added site address. can you help
March 3, 2023 at 6:02 am #2553999David
StaffCustomer SupportOK.
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.
March 3, 2023 at 12:44 pm #2554529dong 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?
March 3, 2023 at 1:59 pm #2554612Ying
StaffCustomer SupportHow 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!
March 4, 2023 at 12:24 am #2554861dong hyeok choi
Customize – Added CSS / I pasted the code here verbatim. There is code at the bottom of the additional css.
March 4, 2023 at 6:33 am #2555241David
StaffCustomer SupportYou need to clear the WP Rocket caches as the CSS isn’t loading.
March 4, 2023 at 12:16 pm #2555685dong 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?
March 4, 2023 at 12:43 pm #2555709Ying
StaffCustomer SupportAs 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 optionIf 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.
-
AuthorPosts
- You must be logged in to reply to this topic.