Can’t seem to get this to work no matter what I try and I’ve been through a bunch of the other posts in this forum trying to find something that works. I just want to show a different ad in the header spot when the category is obituaries. With this code, no ad shows up when the obituary category page is viewed even though I have an ad in the theme settings for Adverts in the Custom Ad 1 field. Any help is appreciated, thanks!
This is my replacement for /parts/header/ads.php:
<div class=”td-header-rec-wrap”>
<?php
$tds_header_ad_title = td_util::get_option(‘tds_header_ad_title’);
// show the header ad spot
if (is_category(‘obituaries’)){
echo td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘custom_ad_1’, ‘spot_title’ => $tds_header_ad_title));
}
else
{
echo td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘header’, ‘spot_title’ => $tds_header_ad_title));
}
?>
Just updating this, I am using the AdRotate plugin and therefore using the shortcodes in some of the ad spots in the Theme settings. I have been using the shortcodes successfully to date, but when I use this conditional code, the shortcode does not work. If I enter the ad code directly into the YOUR AD CODE box, it works OK, but if I enter the shortcode [adrotate group=6] it does not work. I guess I can’t use a shortcode when I am doing this conditional thing, or is there a way around this? It is working using the actual code for the ad, so this is not a real problem, just curious if there is a way around this, like do I have to use [adrotate group=6] or something like that?
Hi,
Unfortunately since the adrotate plugin was never officially tested, I cannot say for sure about the plugin functionality or limitations. We know it works from our users but we never marked it as tested and recommended as we have our own ad system and there was no need for an ad plugin.
Thanks.
Thank you for the info, Bogdan. It is helpful that you allow spots for the ads, but there is no ad management, auto-expiration, grouping, click/impression tracking etc. available in your theme unless you are using Google Ads, so if anyone is not using GA then they do have to use some type of ad manager plug-in. Obviously we can’t expect every theme to be compatible with every plug-in but a lot of us DO need to use an ad manager on our site(s). In any case, I think we are all hoping for a way to show a different ad based on the post category, so hopefully that option will be available in a future version of Newspaper so we don’t have to use hacks to hide the ads on our obituary pages đ I think your theme is awesome and I am not trying to be critical, just want you to understand the needs of your users. Thanks!
Bogdon,
I just paid for AdRotate and that may be what is blocking my post types from appearing. However – I may not need to use ad rotate at all if there is a way to take Google DFP code and implement it into the spots that are built in.
I see info that states that Google AdSense works – will google DFP Coding?
Thanks
Hi,
As far as i know adrotate is free and does not require payment, but I could be wrong.
Google DFP has a special implementation necessary in our theme as it will not work off the bat. Please read this topic: https://forum.tagdiv.com/topic/tutorial-responsive-ads-with-google-dfp/
Thanks.
