Got a moment to help with a php hack?
I'm looking for some help with a php hack.
I'm using the Random Ads Rotator plugin from datafeedr.com
There is a single line include that you can put anywhere in your template which looks like this:
<?php if (function_exists('dfrad')) { echo dfrad('ad_468x60'); } ?> You can change that to whatever you like.
Let's say I have three categories on my WP blog: "tomatoes", "oranges", and "ice cream".
I'd like to place that php-include, above, in the template and then call ads depending on the category of the post.
So, for example...
If a post is about tomatoes, then it returns the 468x60 banners about things related to tomatoes (and rotates them).
If a post is about oranges, then it returns...
...and so on.
But I'm not a coder. The way I understand that code, above, is that it asks the script to check if the "dfrad" function exists and if it does, to serve whatever I've put into the 'ad_xxx' value.
So this is my completely ignorant attempt to hack the code so that there are two if statements and a series of options.
I'm quite sure it's wrong -- which is why I'm asking for help -- because I know next to nothing about php.
Any help would be greatly appreciated.
Cheers,
TheNightOwl
<?php
if (($function_exists=="dfrad" && $category=="tomatoes"))
{ echo dfrad('ads_tomatoes_468x60'); }
or
if (($function_exists=="dfrad" && $category=="oranges"))
{ echo dfrad('ads_oranges_468x60'); }
or
if (($function_exists=="dfrad" && $category=="icecream"))
{ echo dfrad('ads_icecream_468x60'); }
else { echo('ads_meat_300x300'); }
?> -
maxleadford -
[ 1 ] Thanks
{{ DiscussionBoard.errors[996466].message }} -
-
TheNightOwl -
Thanks
SignatureWho is Gatchaman?{{ DiscussionBoard.errors[998420].message }} -
-
maxleadford -
[ 1 ] Thanks
{{ DiscussionBoard.errors[1004400].message }} -
-
TheNightOwl -
Thanks
SignatureWho is Gatchaman?{{ DiscussionBoard.errors[1005534].message }} -