Hi Alin,
i have to ask you sorry because when i looked at your screencast i didn’t realized you also posted the hide_ad code.
By the way, now i did it exactly as you posted and i have this code in the td_block_ad_box.php file:
$buffy = '';
if (!get_field('hide_ad')) {
$buffy .= '<div class="td-a-rec td-a-rec-id-' . $spot_id . $align . ' '
. ((!empty($ad_array['disable_m'])) ? ' td-rec-hide-on-m' : '')
. ((!empty($ad_array['disable_tp'])) ? ' td-rec-hide-on-tp' : '')
. ((!empty($ad_array['disable_p'])) ? ' td-rec-hide-on-p' : '')
. '">';
$buffy .= do_shortcode(stripslashes($ad_array['ad_code']));
$buffy .= '</div>';
}
//print_r($ad_array);
return $buffy;
}
}
But this does not make my ads to desappear (my custom ad field is named the same)… they are still there (all of them).
-
This reply was modified 10 years by
reloaded.
ok, i was able to hide the top header ad by modifying ads.php file in the “header” folder and the code i used is this one:
<div class="td-header-ad-wrap <?php echo $td_no_ad_class;?>">
<?php
//show the header ad spot
if (!get_field('hide_ad_all')) {
echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'header'));
}
?>
</div>
But i really can’t understand what to do for the sidebar.
I think the code to be used should be something like this:
//show the sidebar ad spot
if (!get_field('hide_ad_all')) {
echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'custom_ad_1'));
}
where “hide_ad_all” is a custom field i just created only for top header and sidebar ads and because i’m using custom ad 1 in the articles’s sidebar but i don’t understand where or in which file to paste this code. I tried with sidebar.php, td_block_ad_box.php and others but with no results.
if someone has any idea…
-
This reply was modified 10 years by
reloaded.
Hi shae101s,
as i said previously, i already managed to hide the 3 “in post” ads… but what i’m trying to hide as well are sidebar and top header ads which are located outside of the post’s loop. If a specific blog post is not compliant with adsense policy i guess that all of the ads must be deactivated and not only those inside the article by themself.
I’m still trying to paste the code in the file you suggested, even just this part of the one above:
//show the header ad spot
if (!get_field('hide_ad')) {
echo td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'header'));
}
but or i get syntax error or simply nothing happens and ads keeps showing
-
This reply was modified 10 years by
reloaded.
Hi Alin,
thanks for answering, can you be a little more specific? I’m not that good in coding and i get syntax errors.
Also, should i use only this file to hide all of the ads then? or it is this file + the td_module_single_base.php file?
Thanks again!
Paolo
Hi guys,
i was looking for the solution to this problem: i perfectly managed to hide ads IN the article (thanks to this discussion), but i could not be able to hide them in the top header (which is outside the article block) and in the sidebar.
I tried to edit the header-style-3.php (which is the style i got set from the newsmag menu i guess) file but no results on that, the ad stills there and this is the code i insered in this file:
<div class="span8 td-header-style-1">
<?php
//show the header ad spot
if (!get_field('hide_ad')) {
echo td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'header'));
}
?>
</div>
Am i doing something wrong? And what should i edit for the sidebar?
My website post page where i’m trying to hide them is this one: MyTechnology
-
This reply was modified 10 years by
reloaded.
Yeah i agree with lulu1984, i just would like to understand what should be the purpose for the trending now bar, which is cool but if it is treding then it must be visible…
is it possible maybe to associate it to something like “most viewed articles”? That would sound enough trending and would not always affect the latest posts to burn their visibility
great! that actually just save my life! thanks!
Edit: i found the settings that avoid the doubled image.
It remain the problem of image thumbnail generation…they don’t, and there always must be a featured image set in order to create it