Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   Conditional category styling = PHP (http://forum.bytesforall.com/showthread.php?t=11774)

bender57 Dec 17, 2010 09:01 AM

Conditional category styling = PHP
 
Hi everyone !

I am so stuck with a conditional display in PHP. :confused:

Could you please help to fix the following conditions:

What I want to do (in a VBA way...) in the LOOP

If category='uncategorised'
then "Do not display KICKER"
else
If category='red'
kicker background=red
if category='blue'
kicker background=blue


The ultimate goal is to display a background image different per category in the KICKER only on the homepage and display nothing if no category.

I've got this code but full a errors...

Code:

<?php bfa_post_kicker( if (in_category('red'))
{ ('<div class="post-kicker">','</div>') ?>
<?php } ?>

Thanks for helping a poor PHP guy... :p

juggledad Dec 17, 2010 07:09 PM

you have to watch switching in and out of php/html. Your code should be in The LOOP and it should replace the line
HTML Code:

<?php bfa_post_kicker('<div class="post-kicker">','</div>'); ?>
with
HTML Code:

<?php (if (in_category('red')) { ?>
<div class="post-kicker-red"> <?php } ?>
<?php bfa_post_kicker('<div class="post-kicker">','</div>'); ?>
<?php (if (in_category('red')) { ?>
</div> <?php } ?>

then in CSS Inserts you would use
HTML Code:

div.post-kicker-red .post-kicker {background: red;}


All times are GMT -6. The time now is 12:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.