Different Ads on Pages

Posted in: Newsmag
Post count: 2

Hi,

we’d like to display custom ads on the Home Page and Google Ads on all sub-pages. Is this possible with this theme or did you already find a custom solution for this?

Thank you!

Post count: 6535

Hi

The theme doesn’t have an option to display different types of ads on the site, for example the header ad will be displayed from the same spot on all pages and posts. If you want a different ad for homepage you need to add a condition in ads.php file like here: http://screencast.com/t/BqOhbFzqqpGS and insert the shortcode corresponding with the ad spotthat you want to use. To get the shortcode add an ad box into a blank page then switch in backend editor copy and paste this code: http://screencast.com/t/Kcqsjk9C7xbU inside do_shortcode function
For the ads from page content you can use the ad box block and use the corresponding spot for your ad: http://screencast.com/t/YlkV5d5yke

Let me know how it goes.
Thanks!

Post count: 2

Hi Andrei,

I customized the code as you explained in the screenshots but after uploading the new ads.php my page didn’t load further than the header. Could you please be so kind to have a look at the code below?

Thank you so much!

__________
<?php
//@todo verifica daca ai ad daca nu pune clasa

$td_ad_array = td_util::get_option(‘td_ads’);
$td_no_ad_class = ”;

if(!empty($td_ad_array[‘header’])) {
if (empty($td_ad_array[‘header’][‘ad_code’])) {
$td_no_ad_class = ‘ td-ad’;
} else {

if (empty($td_ad_array[‘header’][‘disable_m’])) {
$td_no_ad_class .= ‘ td-ad-m’;
}

if (empty($td_ad_array[‘header’][‘disable_tp’])) {
$td_no_ad_class .= ‘ td-ad-tp’;
}

if (empty($td_ad_array[‘header’][‘disable_p’])) {
$td_no_ad_class .= ‘ td-ad-p’;
}
}
}
?>

<div class=”td-header-ad-wrap <?php echo $td_no_ad_class;?>”>
<?php

// show the header ad spot
if(is_front_page()) {
echo do_shortcode(‘[td_block_ad_box spot_id="custom_ad_4"]‘);
} else{
echo td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘header’)); ?>

</div>

Post count: 6535

Hi

I looked over your code and noticed that a bracket is missing: http://screencast.com/t/NYNt91ES that’s why you got that error. Please add the bracket as is indicated in screenshot or just replace the code from ads.php with this one: http://pastebin.com/Gb1a0ndU and test again.

Let me know how it goes.
Thanks!

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