• hi, im noobs in programming and i have a problem in categories

    i have a lot of categories, but category = 16 or freebies have subcategories. if you call the category 16 and its subcategory it will change the navigation of the page.

    here’s my current code

    <?php	if ( is_category('16') || is_category(array( '15', '11', '13', '10', '12', '14' )) ) {
    ?>
    
    <ul>
    <li>sub category of 16</li>
    <li>sub category of 16</li>
    <li>sub category of 16</li>
    </ul>
    <?php	} else { ?>
    
    <ul>
    <li>all categories except freebies and its subcategory</li>
    <li>all categories except freebies and its subcategory</li>
    <li>all categories except freebies and its subcategory</li>
    </ul>
    <?php }?>

    This code works fine for me in this URL
    1. example/category/freebies/
    2. example/category/freebies/subcategory

    NOW WORK in this URL
    1. example/freebies/subcategory/post-title/
    2. example/category/freebies/page/2/

    i know there’s missing in my if else statement and i dunno if the problem is in the child or parent something…

    sorry in my poor english.

  • The topic ‘is_category() if else statement’ is closed to new replies.