Custom header ad

Posted in: Newspaper
Post count: 3

Hi,

I would like change header ad for specific page. I already add new custom ad boxs for every page by adding new value in array in files td_config.php and td_panel_ads.php.

Now I want for example replace Header ad with Custom ad 1 ad on http://mydomain.com/page1 and
Custom ad 2 on http://mydomain.com/page2 and so on…

How can I do that? Thank you very much for your support.

Best regards,
Tim

Post count: 22421

Hello,
In orer to do that you can either use a plugin such as adrotate or you can edit the theme files and add conditions to the ad code. You can find the header ad here: http://screencast.com/t/syA5BkaQsjQ If you have the coding knowledge, you can add an if else statement here and use the is_page function: https://developer.wordpress.org/reference/functions/is_page/
Hope this helps.
Thanks.

Post count: 3

Hello,

thank you, I found this post as very useful I made changes bellow it may helps anyone else:

<div class="td-header-rec-wrap">
<?php
// Custom ad for custom pages
if ( is_page( 'page1' ) OR has_category( 341 ) OR in_category( 341 ) OR is_category( 341 ) OR cat_is_ancestor_of( 341, $cat ) ) {
echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'custom_ad_1'));
} else {
// show the header ad spot
echo td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'header'));
}
?>
</div>

Thank you again.
Best regards,
Tim

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