View Single Post
Old 04-19-2007, 10:36 AM  
clickhappy
Confirmed User
 
Industry Role:
Join Date: Mar 2004
Posts: 4,027
Quote:
Originally Posted by deadmoon View Post
ok, lets say you've got 3 categories,
babe
lesbian
black

this is untested, but should work ...

PHP Code:
<?php
if (is_category('babe')) {
?>
<a href="#"><img src="yourbabeadvert.jpg" alt="" /></a>
<?php
}

if (
is_category('lesbian')) {
?>
<a href="#lesbian"><img src="yourlesbianadvert.jpg" alt="" /></a>
<?php
}


if (
is_category('black')) {
?>
<a href="#black"><img src="yourblackadvert.jpg" alt="" /></a>
<?php
}

?>
As said, http://codex.wordpress.org/Conditional_Tags is where you want to look. Hit me up over icq if you need help. Note- that will display the ad when viewing just the category page itself. To display it when viewing a post in category x, use in_category()

It works!!
Thank you!

btw, I have a LOT of categories, would this slow down the page to have like 50 categories listed inthis code? is there a way to make it so I dont slow down the page processing?
clickhappy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote