• Hi, I have this code below thats working til 2-3 choices, after that it wont work and skips trough to the last one..

    How come? How do I make this work. I want to switch css on 7 category’s..

    Thanx in advance!

    <!-- CHANGE CSS ON CATEGORY -->
    
    <?php if( in_category( 5 ) ) //fitness
    { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_url')?>/sportsbar-fitness.css" type="text/css" media="screen" />	
    
    <?php } elseif ( in_category (3) ) //voetbal
    { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_url')?>/sportsbar-voetbal.css" type="text/css" media="screen" />
    
    <?php } elseif ( in_category (65) ) // basketbal
    { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_url')?>/sportsbar-basketbal.css" type="text/css" media="screen" />
    
    <?php } elseif ( in_category (66) ) // golf
    { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_url')?>/sportsbar-golf.css" type="text/css" media="screen" />
    
    <?php }	else
    { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_url')?>/sportsbar.css" type="text/css" media="screen" />
    
    <?php }	?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Mathieu Scholtes

    (@ontwerpexpert)

    No one knows this??

    hi,
    i v just seen a little mistake:
    it s:
    <?php if ( !in_category(‘3’) ): ?>
    not
    ( in_category (3) )
    for all id…

    hope it helps,
    bye

    the code looks ok, so the error could be with the existing category ids?

    are these the way you assume?

    without a link to your site, you have to check this yourself.

    Thread Starter Mathieu Scholtes

    (@ontwerpexpert)

    Thanks for thinking along.

    The website is not official launched, because its being build on the background.

    Here are some login passwords so u can view the website. U need to login and then you can see the website at its original domain. (maybe refresh browser)

    Login: here

    Vieuw website: here

    name: wordpress
    Passw: wordpress

    The ! did not fix it and the ‘ ‘ did not either.

    Its the images, the 7 on a row almost at the top. The weightlift and the footbal works, the other 5 dont. :s

    Thread Starter Mathieu Scholtes

    (@ontwerpexpert)

    No one? It can’t be that difficult?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘If Else stops working after 2-3 choices’ is closed to new replies.