- This topic has 13 replies, 3 voices, and was last updated 3 years, 3 months ago by
Ying.
-
AuthorPosts
-
January 12, 2023 at 8:39 am #2493088
Manoj Kumar
Hello,
I have set AdSense code on my site using Hook element. Bud Ads are aligned on left side. For example I have placed an code above header, but is displaying to the left above header. Please let me know if there is a way to set this Ads to center?
Thank You
January 12, 2023 at 12:09 pm #2493342Ying
StaffCustomer SupportHi Manoj,
Any chance you can link us to your site where we can see the issue?
You can use the private info field for this.January 13, 2023 at 8:26 am #2494422Manoj Kumar
Hi
Sure, I have attached the link. You can see Ads before and after content are aligned to left. Same case for Mobile also.
One more issue is there, I have using fixed size Ad (336 x 280) which is displaying correctly on desktop. But in Mobile it is displaying as responsive.
Thank You
January 13, 2023 at 11:53 am #2494621Ying
StaffCustomer SupportTry this CSS:
.single-post .inside-article ins.adsbygoogle { margin-left: auto; margin-right: auto; display: block; } .single-post .inside-article { display: flex; flex-direction: column; }But in Mobile it is displaying as responsive.
What does this mean? Do you mean it’s not responsive on mobile?
January 13, 2023 at 1:03 pm #2494688Manoj Kumar
Hi Ying,
Thanks for the solution. It’s working well. But I want to align Ads on center for entire site. It is working on single post only.
I have chosen 336 x 280 fixed Ad size on single page (before and after content). But is is displaying much larger than the size specified.
Thank You.
January 13, 2023 at 1:08 pm #2494693Ying
StaffCustomer SupportIt is working on single post only.
You just need to remove
.single-postfrom the code 🙂I have chosen 336 x 280 fixed Ad size on single page (before and after content). But is is displaying much larger than the size specified.
Can you link me to the page?
January 14, 2023 at 12:37 am #2495022Manoj Kumar
Hi,
I have removed .single post from CSS code but Ad on home page after header is still aligned to left. Kindly provide me a CSS code for the same.
Also I am using 320 x 50 ad code on home page just after header. It is correctly displaying on desktop. But in case of mobile it is displaying as a big square. It should display with 320 width and 50 height. Same issue is with Ads in single post where I am using 336 x 280 ad unit. How can I fixed this issue?
Please check the link for both the issues.
January 14, 2023 at 4:30 am #2495153David
StaffCustomer SupportHi there,
how was the home page advert added tom the site ?
January 14, 2023 at 6:32 am #2495228Manoj Kumar
Hi,
I am using Hook element to show AdSense on front page and Single post.
Setting> Hook > generate_after_header
Display Rules > Location > Front pagePlease help me in achieving:
1. Ads in center
2. Fixed Ad size
3. Hide different Ad on desktop and MobileThank You
January 14, 2023 at 9:49 am #2495547David
StaffCustomer SupportIn the hook wrap your script in the following HTML:
<div class="grid-container ad-over-content"> your script here </div>January 14, 2023 at 11:10 am #2495595Manoj Kumar
Hi David,
Still ad is aligned to left, this time inside the container. Is it possible to align ads at center for entire site (front page, single post) with one code? Can you please provide me some code so that I can achieve all this 3:
1. Ads in center
2. Fixed Ad size
3. Hide different Ad on desktop and MobileThank You
January 14, 2023 at 12:44 pm #2495707Ying
StaffCustomer Support1. Edit all of the elements that contain ads to David’s format:https://generatepress.com/forums/topic/aligning-ads-using-hook-element/#post-2495547
2. For ads that you want it to hide on mobile, add another CSS class to the
<div>, so the element would be:<div class="grid-container ad-over-content hide-on-mobile"> your script here </div>For ads that you want it to hide on the desktop, replace the
hide-on-mobileclass withhide-on-desktop.
For more info about GP’s responsive display, check this article: https://docs.generatepress.com/article/responsive-display/3. Add this CSS:
.grid-container.ad-over-content { text-align: center; }January 30, 2023 at 7:27 am #2514120Manoj Kumar
Hi,
How can I show “advertisement” text above Google Ad?
Thank You
January 30, 2023 at 1:35 pm #2514687Ying
StaffCustomer SupportYou just need to add one more line:
<div class="grid-container ad-over-content hide-on-mobile"> <p>advertisement</p> your script here </div> -
AuthorPosts
- You must be logged in to reply to this topic.