Rotating Ad Code on Ad Panel

Posted in: Newsmag
Post count: 17

Hi. Can I use the author conditional tag is_author( ‘1’ ) on the ad panel?

I’m thinking showing a set of ad code for different authors.

is_author( ‘4’ )
<ad code1>
else
<ad code2>

Post count: 6535

Hi

If you want to display different ads for author archive page then you can add a condition in ads.php file like this: http://screencast.com/t/TndoHgQ3IdZ
If this is not what you mean please provide more details so I can get back to you with a more accurate answer.

Thanks!

Post count: 17

Hi Andrei,

That’s exactly what I want to happen. But that would mean I would modify I core file on your theme, correct? I’m trying to refrain from that so I can update it seamlessly.

Can I not do the same on Ads section of the Theme Panel here: http://tinypic.com/r/294hwy1/9

Thanks.

Post count: 17

Or can I implement that via Child Theme (which came with the package) ?

Thanks.

Post count: 6535

Hi

To achieve the desired result are necessary some file customizations but not in theme panel area because there the ad spots only keep the code, even if is used or not on a page/page. You have to modify the condition in which a specific ad spot it’s outputted. For example on every page the header ad is outputted by it’s specific spot so if you want a different header ad for author archive page you need to add a condition for that. Basically you change the output depending by your needs by replacing the current ad spot with a different one, if some condition is met.
The panel part of our theme can’t be modified via child theme, any customization must be made in the main theme file.

Thanks!

Post count: 17

Thanks Andrei,

So for this particular case, I’ll just modify ads.php by adding author ID and then include the Adsense code on 2 different custom ad blocks?

Can you kindly show an example say I decide to put the 2 rotating ads on custom ad block 1 and custom ad block 2?

Post count: 17

Also, what if I want the conditional ad to appear on Article Top, Article Inline and Article Bottom?

Post count: 6535

Hi

For header ads please check this link: https://forum.tagdiv.com/topic/different-header-ads-on-each-page/ I’ve posted a solution there, you may use it and eventually adapt it as needed. 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
For ads from post content you will need to modify the td_module_single_base.php file and add your conditions here: http://screencast.com/t/xnSMzdwiz

Thanks!

Post count: 17

Hi. I tried this on Newspaper theme instead of Newsmag, I reckon they almost have the same files. It work on the first ad spot, LINE 400 which put the ad right below the post title… but when I tried it on the other spots LINE 443 and LINE 449, hoping to put then INLINE and the BOTTOM of the post, it just repeated the ad above – right below the title. So I ended up having 3 consecutive ads below title of the post.

http://content.screencast.com/users/suport001/folders/Jing/media/bd2ef5e4-8107-4331-89af-2053f488b39b/2016-01-11_0833.png

Post count: 6535

Hi

You need to use different ad-spots in order to have different ads:
For example

if cond1{
echo adspot 1
}
elseif cond 2{
echo adspot 2
}

Please note that any changes in theme files involve basic php knowledge. Unfortunately we cannot offer any type of custom work at the moment so if you can’t do this by yourself my advice is to look for someone which may help you or hire a developer to do this for you.

Thanks!

  • This reply was modified 10 years by Andrei L..
Post count: 17

Hi Andrei,

That isn’t the problem. It’s this: Putting the conditions on LINE 400, LINE 443 and LINE 449 resulted into ads appearing right below the title, instead of different parts of the article (Inline and Bottom)

Post count: 6535

Hi

Your conditions should look like this: http://screencast.com/t/3PrP73R5oHk Make sure that you concatenate the new adbox to the content, otherwise it won’t be displayed fine. In this example I used the original implementation of the theme regarding ads, but you also can use do_shortcode function.

Thanks!

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