-
ChristPulse
I am using hooks for adsense ads placements. The issue is in the sidebar area (for Desktop). It is not aligned well.
-
Hi there,
You are adding 20px
margin-left
to each GB container in the right sidebar, while your ads do not have themargin-left
.I would recommend removing the
margin-left
from the GB containers in the right sidebar, and adding a padding-left to the entire sidebar:.inside-right-sidebar { padding-left: 20px; }
-
ChristPulse
It worked on Desktop. Thank you. But it affected mobile as well. Now the mobile sidebars are put inside too much.
Also, is there a way to put this particular Ad Hook a bit down like top padding for 10px?
The top ad on mobile is also aligned on the left; it should be centered.
What code should I include in the Hook to center it or adjust alignments?
-
Alvind
Hi there,
Could you edit the hook element like this first:
<div class="grid-container ad-over-content hide-on-mobile"> your script here </div>
and
<div class="grid-container ad-over-content hide-on-desktop"> your script here </div>
-
ChristPulse
Okay, but I guess first I need to resolve another issue which might be connected. Please see the screenshot:
https://postimg.cc/4YKDH9YVOn my mobile there is some extra white space (see on the right) if I move the screen to the left. No idea why this happens.
And when page is loading impages resize to the right dimensions after some time, at first they are centered then they adjust to the proper size.
-
It’s caused by the custom header, the parent container of the header has a
margin-right
set to -20px on mobile, set it to 0 should fix the issue. -
ChristPulse
Thank you. There is still a bit of a margin left, though almost gone. But humburger icon is positioned more left than I would wanted
and see how images are placed on the left instead of covering the entire space:
https://postimg.cc/RNs1qvbn -
You adeed this CSS which only adds space to the left, so it’s uneven.
.inside-right-sidebar { padding-left: 20px; }
Try adding this as well for mobile:
@media(max-width: 768px) { .inside-right-sidebar { padding-right: 20px; } }
-
ChristPulse
I added the code, but the issue is still there. There must be something else that adds extra width to the right side. Maybe the adds. After I converted them into hooks and managed them only as hook codes, I had alignment issues.
-
Alvind
If the hook is temporarily disabled, does the spacing layout display correctly?
-
ChristPulse
will try, I have many hooks, for all the ads on all different places
-
ChristPulse
Mobile Homepage is still somehow aligned on the left (the only place where ads are not hooks but inserted as elements). I hide them but still there is a problem.
Other pages are now ok, after hooks disabled.
Place take a look at my homepage in mobile view.
-
ChristPulse
Private info edited
-
ChristPulse
A question. From an optimization perspective, is it better to manage Adsense ads as hooks (pure code and placements) or create them as elements and then hook them in various places?
If I create elements and put them in containers, I have more control over how they appear in various places without adding extra CSS codes. But if this means more burden and style requests, I guess it is better to only hooks.
What happens now on a single post on Mobile (now that hooks are disabled)? At first, it is presented well, then the ad appears for a second, then disappears, and the layout is distorted.
These lines of code were added only because of those Ad Hooks. And it is not working well-
If you don’t mind, can you go into the admin (private info) and see the best solution?
-
David
Hi there,
the alignment issues on the home page, there are 2 main problems:
1. a container block has a Sizing > Width of 400px which is causing overflow on smaller screens.
See here:https://app.screencast.com/eXMwpUGe8lg12
Set the Sizing > Max Width to
100%
to stop it from overflowing2. the lack of padding, in the Customizer > Layout > Container -> Mobile preview. There is NO Left and Right Padding, so the content sticks to the edge of the browser.
Regarding Elements vs a PHP Snippet for hooking in adverts. The performance difference between the two, if any would be unnoticeable
-
ChristPulse
Thank you. I am on it. Which of these two would you recommend?
- You must be logged in to reply to this topic.