Hi guys,
I was wondering if there is a way of Removing “The Header Ad” from a specific page is possible?
Maybe editing the ads.php with an is_page () else statement of sort?
Please let me know
Hi,
The theme doesn’t have such a setting, the ad will be displayed permanently. Usually, this could be done with CSS but in the case of Adsense ads, Google will not allow them to be hidden with CSS.
You could create a condition in the header template 6 file you are using. Something like in this topic
– https://forum.tagdiv.com/topic/my-header-ad-are-not-in-the-middle-of-the-page/
The condition would be – if this is not a post IDs -> show the ad
– https://www.screencast.com/t/oL6gb45vq
So the ad will not be loaded for those posts.
Or you could try using a plugin such as Adrotate, I believe that has such settings
– http://www.wpbeginner.com/plugins/how-to-manage-ads-in-wordpress-with-adrotate-plugin/
– https://ajdg.solutions/manuals/adrotate-manuals/
Thank you!
Hi Catalin,
I modified file header-style6.php
<?php if (td_util::is_ad_spot_enabled('header')) { ?>
<div class="td-banner-wrap-full td-container-wrap <?php echo td_util::get_option('td_full_header'); ?>">
<div class="td-container-header td-header-row td-header-header">
<div class="td-header-sp-recs">
<?php if ( ! is_single( array('1027', '67707') )) {locate_template('parts/header/ads.php', true);} ?>
</div>
</div>
</div>
I used the code you provided And the ad still shows….but doesn’t this statement above mean, if you are this page, then load this Ad.php… how do i make it so that it loads that “ads.php” file unless is NOT, the page ID’s i want to exclude from?
Can i use something like this:
<?php if (td_util::is_ad_spot_enabled('header')) { ?>
<div class="td-banner-wrap-full td-container-wrap <?php echo td_util::get_option('td_full_header'); ?>">
<div class="td-container-header td-header-row td-header-header">
<div class="td-header-sp-recs">
<?php if ( ! is_page( array('1027', '67707') return false);
else {locate_template('parts/header/ads.php', true);} ?>
</div>
</div>
</div>
<?php } ?>
-
This reply was modified 7 years by
Freddy Meynard.
Hi,
Try the following quick solution for your header style 6 -> http://prntscr.com/mzybur
Hope that help!
Thanks.
Hi Catalin,
The ads still appear on the page, even though i modified the header-style-6 as you suggested.
https://ibb.co/JF2H2kc
https://ibb.co/4T7ngs1
I have tried clearing cookies and emptying my cache, but the Ads still show up.
Hi,
I have inspected your website and I saw that on this page, you have placed more ads. The condition is working fine. Without it, you will have two ads, one under the other, as you can see here -> http://prntscr.com/n0e0pb -> http://prntscr.com/n0e142
Thank you for your understanding!
The idea is to only have the one i am manually placing…and for the original theme header Ad to be removed via the script… the ad for me still shows up, i have used CSS to hide it… but i dont want it hidden, i want it gone.
-
This reply was modified 7 years by
Freddy Meynard.
The ad that is visible on that specific page has been added via TD composer. The header ad was injected via Theme panel. While i can hide things with CSS, i would like to remove it completely from specific pages..but the code as used above still displays the Theme injected ad in the header of the page. Please help
Hi,
If you want to hide some elements using the CSS on the specific pages, you need to use the page ID for that page and then, hide the class you want for your element. Please check the Inspector Browser tool from here -> https://forum.tagdiv.com/create-custom-code-using-the-browsers-inspector/
Thank you!
Hi Catalin,
I dont think you are understanding my request. There is CSS already in PLace, which is hiding the original Theme Header Ad.
The Ad that is currently visible in that page was added via TD Composer.
I want not to just “Hide” the Top Banner Ad that is get injected by via Theme Panel, I want to “Completely Remove from specific pages”. I tried the code above and it didnt work. I emptied my cache and it would always show up, which is why i ended up applying css to hide it.
I am just wondering if you can help me troubleshoot the code written for header-style-6.php
<?php if (td_util::is_ad_spot_enabled('header')) { ?>
<div class="td-banner-wrap-full td-container-wrap <?php echo td_util::get_option('td_full_header'); ?>">
<div class="td-container-header td-header-row td-header-header">
<div class="td-header-sp-recs">
<?php if ( !is_page('1027') {locate_template('parts/header/ads.php', true);} ?>
</div>
</div>
</div>
Hi,
I have checked again that code on my website, with a specific page ID and works as expected. Do you want to add that code for more pages? In that case, you need to add more page IDs, followed by the comma. -> https://www.screencast.com/t/UJFCqsPGj6 If is not what you mean, please provide more details and if you want the exact thing and if it does not work, please send us an email at contact@tagdiv.com with your log-in information (wp-admin) and CPanel access so we can add that code and make some tests.
Thank you!
