Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

Conditional category styling = PHP


  #1  
Old Dec 17, 2010, 09:01 AM
bender57's Avatar
bender57
 
16 posts · Apr 2010
France
Hi everyone !

I am so stuck with a conditional display in PHP.

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...
  #2  
Old Dec 17, 2010, 07:09 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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;}
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with parent category php? Please!! theadventurebite Plugins & Atahualpa 1 Jul 6, 2010 05:05 AM
Conditional PHP issue MyJourneytoMillions Center area post/pages 6 Feb 10, 2010 03:11 PM
category pages missing styling sharmtravel Header configuration & styling 0 Aug 21, 2009 06:01 AM
How do I provide a conditional Widget in the sidebars? bgt Forum How-To 1 Jun 1, 2009 02:16 PM
Styling Category Widget BigG Sidebars & Widgets 3 Apr 16, 2009 11:53 AM


All times are GMT -6. The time now is 10:55 PM.


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