Custom Ad block on side bar moves to center below the menu area

Posted in: Newspaper
Post count: 7

Hello, when I put a custom ad block in the sidebar in the TagDiv Composer, it moves down the main menu, above the highlighted content.

The custom code is from a Google Ad Manager account, I programmed it with a shortcode, I made one for the header and it works fine, but if I put it in the area that manages the TagDiv Composer it moves to the mentioned position.

The code generated by the shortcode is:
<div id = “div-gpt-ad-XXXXXXXXXXXXX-3” data-id = “Desktop_Home_300x250_1” class = “ad_300x250”>
<script type = ‘text / javascript’>
googletag.cmd.push (function () {
googletag.display (‘div-gpt-ad-XXXXXXXXXXX-3’);
});
</ script>

This code is exactly after <div class = “tdc-content-wrap”>

The class ad_300x250 is the following:
.ad_300x250 {color: #fff; width: 300px; display: block; margin: auto;}

The personalized code is in this position:
https://pasteboard.co/If2R9q7.png

And it appears in this, the leaderboard is in correct position:
https://pasteboard.co/If2Runo.png

I hope you can help me.
Thanks in advance.

Post count: 20688

Hi,

That code is not quite complete, the closing div tag is missing from what I can see
http://prntscr.com/nprhhz
Maybe that is what is causing the problem.

Thanks

Post count: 7

The div code closes correctly, I forgot to copy that part.

I think the error comes from my code calling it from a shortcode. And the TagDiv Composer is also a shortcode on the page.

Could not nest one shortcode inside another.

I solved it by creating a widget bar, and inside that bar I put a ad widget configured with an ad zone, like Sidebar Ad in the theme panel.

And inside the Sidebar Ad I put the shortcode, it works very well, it detects where I am (home, article, tag, editor, etc) and according to that shows the corresponding Google Ad Manager code.

Thanks!!

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.