- This topic has 25 replies, 3 voices, and was last updated 4 years, 9 months ago by
Elvin.
-
AuthorPosts
-
July 14, 2021 at 3:13 am #1855189
vaibhav
I want reserve space for ads in header & side bar but i dont know how to do it…
If we create placeholder or container for ads already then it will not create layout shift..
Can you help me in that?
July 14, 2021 at 4:33 am #1855257David
StaffCustomer SupportHi there,
you would need to add a HTML wrapper around your script eg.
<div class="header-advert-wrap"> // Your Ad script goes here </div>Then you can sue some CSS to set a minimum height:
/* Set min height of ad container */ .header-advert-wrap { min-height: 300px; } /* Optional - adjust height on mobile */ @media(max-width: 768px) { .header-advert-wrap { min-height: 200px; } }July 14, 2021 at 5:41 am #1855313vaibhav
.header-advert-wrap { min-height: 300px; This code is started from .header or above line/* Set min height of ad container */
.header-advert-wrap {
min-height: 300px;July 14, 2021 at 5:57 am #1855337vaibhav
Main Adsense code was already added in header. So i need wrap that Same code with given code.
July 14, 2021 at 6:16 am #1855370David
StaffCustomer SupportYes, you need to simply add the
<div class="header-advert-wrap">before your script and the</div>after it.
And the CSS goes in your Customizer > Additional CSS or in your child themes styles.cssJuly 14, 2021 at 6:30 am #1855396vaibhav
But Im getting error of NO slot size mention. You can check on by inspecting it
July 14, 2021 at 6:35 am #1855401vaibhav
Only it shows white blank space.
July 14, 2021 at 6:50 am #1855411David
StaffCustomer SupportTry this CSS instead:
.header-advert-wrap { min-height: 300px; display: inline-block; width: 100%; } .header-widget { width: 100%; min-height: 300px; }July 14, 2021 at 7:07 am #1855427vaibhav
Actually Code that given at starting is working now because I directly added that First code to insert header & footer plugin instead of custom html widget in header.
But ad is showing above my site title and i want that just below the title or at right side. how i can do it?July 14, 2021 at 5:40 pm #1856112Elvin
StaffCustomer SupportHi there,
Can you link us to a sample page where this is occurring? So we can inspect the page and see if things are properly applied.
You can use the private information text field to provide the link. 😀
July 15, 2021 at 10:37 am #1857148vaibhav
See David given me following code, it works fine for me.
But i just removed all ads now so you will not see any ad on header….
But i can show you below;० how ads look like after wrapping code,
This is how Header section look,
“Here ad show above title”
My site title (myindiasupport)
Meanu-search barThis is how Header section ad I want,
My site title(myindiasupport)
“Here my ad must be shown”
Menu-search barIn short i want ad between site title and menu search bar….
So which code i need change for it.
I just added my site link but it doesn’t not show ad in header as i removed it because of some reason.
But you can understood from above easily.
Codes,
* Set min height of ad container */ .header-advert-wrap { min-height: 300px; } /* Optional - adjust height on mobile */ @media(max-width: 768px) { .header-advert-wrap { min-height: 200px; } }// Your Ad script goes hereJuly 15, 2021 at 11:01 am #1857185vaibhav
Or shout i need to made changes in following code.
Wrapping code <div class header advert`
// Your Ad script goes hereJuly 15, 2021 at 9:52 pm #1857536Elvin
StaffCustomer SupportI’m not seeing the div you’ve mentioned on the site’s page source. –
https://share.getcloudapp.com/kpuDGQYe https://share.getcloudapp.com/DOuq7gA0To clarify further: Is this where you want the ad to appear? https://share.getcloudapp.com/nOuPyp8N
If so, consider hooking the script on
generate_after_headerwith a priority value of 1.If this is where you want to insert the ad – https://share.getcloudapp.com/d5uAdYvK – you should hook the script on
generate_before_right_sidebar_content.July 15, 2021 at 10:18 pm #1857548vaibhav
Currently i removed all <Div class and ads. that’s why you cant see it.
https://share.getcloudapp.com/nOuPyp8N.
This above screenshot shows correct position. Generate-after-header is exact position that i want.
Where i need to add this code? or which code i need to change wrapping code Script or Following CSS code?
Check the first script that david given and tell me where i need to change.`
`* Set min height of ad container */
.header-advert-wrap {
min-height: 300px;
}
/* Optional – adjust height on mobile */
@media(max-width: 768px) {
.header-advert-wrap {
min-height: 200px;
}
}July 15, 2021 at 10:34 pm #1857560Elvin
StaffCustomer SupportThis above screenshot shows correct position. Generate-after-header is exact position that i want.
Where i need to add this code? or which code i need to change wrapping code Script or Following CSS code?
In that case, place the
and contained script on a Hook Element and set the Hook Element’s hook to “generate_after_header” but make sure the priority value is 1.Check the first script that david given and tell me where i need to change.`
`* Set min height of ad container */
.header-advert-wrap {
min-height: 300px;
}
/* Optional – adjust height on mobile */
@media(max-width: 768px) {
.header-advert-wrap {
min-height: 200px;
}
}That one isn’t a script. It’s a CSS. You can place that on Appearance > Customize > Additional CSS.
-
AuthorPosts
- You must be logged in to reply to this topic.