How to show and hide certain Ads banners?

Posted in: Newsmag
Post count: 5

Hi,

I used your documentation link to manage all ads: https://forum.tagdiv.com/ads/

But for example, in homepage i use the following ads structure:

HOME PAGE
Header: Smart Banner
Sidebar Top: 300×250
Sidebar Bottom: 300×250

PAGE POSTS:
Top Content: 336×280
Bottom Content: 336×280
Sidebar: 300×250

I don’t want to use the header banner in the post pages, how can i do to hide it if is not a widget that can be handled by plugins like Display Widgets that allows you to manage visibility of the widgets to hide or show in certain pages.

I hope you can help me.

Post count: 7909

Hi,

I’m not sure what header style do you use but to hide the banner only on post pages please add this condition in your header style file for example if you use header 7: http://screencast.com/t/BStDIFBZ

<?php if (! is_single()){
      locate_template('parts/header/ads.php', true);
}?>

Result:
Homepage: http://screencast.com/t/sZ19VIbbieZy
Post: http://screencast.com/t/MfecsLyCiB

Hope this helps!

Post count: 5

Hi,
Thanks for your answer,

I use the default theme http://prntscr.com/6i4uvj, like this example:

Homepage:
http://prntscr.com/6i4ugv

Single Post:
http://prntscr.com/6i4uq0

Which file do i have to modify?

Thanks!

Post count: 5

Hello again,

I’m using Header Style #2, the file is header-style-2.php and i made te modifications but doesn’t work fo rme, please check the entire code:

<div class=”td-header-container td-header-wrap td-header-style-2″>
<div class=”td-header-row td-header-top-menu”>
<?php locate_template(‘parts/header/top-menu.php’, true); ?>
<?php locate_template(‘parts/header/top-widget.php’, true); ?>
</div>

<div class=”td-header-row td-header-header”>
<div class=”td-header-sp-logo”>
<?php locate_template(‘parts/header/logo.php’, true);?>
</div>
<div class=”td-header-sp-ads”>
<?php if (! is_single()){
locate_template(‘parts/header/ads.php’, true);
}?>

</div>
</div>

<div class=”td-header-menu-wrap”>
<div class=”td-header-row td-header-border td-header-main-menu”>
<?php locate_template(‘parts/header/header-menu.php’, true);?>
</div>
</div>
</div>

I need to disable the header ad in the post pages, i hope you can help me,

Thanks

Post count: 7909

Hi,

If you use header style 2 please modify header-style-2.php like this: http://screencast.com/t/J1hj7mSkP1Cy

<?php if (! is_single()){
locate_template('parts/header/ads.php', true);
}?>

Please modify this in the main theme files not in child theme, at the moment modules and parts files can’t be overwritten via child theme.

Thanks!

Post count: 5

Hello,

I already added the code but the theme still showing the banner in single page. Any idea to fix this little issue?

The URL is: /wp-content/themes/Newsmag/parts/header/header-style-2.php

<div class=”td-header-container td-header-wrap td-header-style-2″>
<div class=”td-header-row td-header-top-menu”>
<?php locate_template(‘parts/header/top-menu.php’, true); ?>
<?php locate_template(‘parts/header/top-widget.php’, true); ?>
</div>

<div class=”td-header-row td-header-header”>
<div class=”td-header-sp-logo”>
<?php locate_template(‘parts/header/logo.php’, true);?>
</div>
<div class=”td-header-sp-ads”>
<?php if (! is_single()){
locate_template(‘parts/header/ads.php’, true);
}?>
</div>
</div>

<div class=”td-header-menu-wrap”>
<div class=”td-header-row td-header-border td-header-main-menu”>
<?php locate_template(‘parts/header/header-menu.php’, true);?>
</div>
</div>
</div>

Post count: 7909

Hi,

If this is exactly your code from header style 2 then the problem is with quotes signs ' ", please replace all your code with this one: http://pastebin.com/F7dhqR2k

Hope this helps!

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