• Resolved dcroe05

    (@dcroe05)


    I’ve developed an alternate post.php template that I use for posts in a certain category. But what I’d like to do now is modify the conditional a little, and PHPwise I’m a little lost.

    This is how my code is now:

    <?php if ( in_category('26') ) { ?>
                      <div class="post-ws">
                      <?php require('post-ws.php'); ?>
            <?php } else { ?>
                      <div class="post">
                      <?php require('post.php'); ?>
            <?php } ?>

    How would I change the IF to use the alternate post-ws.php if a post is in category 26 and not in any other category aside from category 3?

    i.e.:
    Post is in…………………………….Template to use
    Cat-26 only…………………………post-ws.php
    Cat-26 & Cat-3……………………post-ws.php
    Cat-26 & Cat-Other…………….post.php
    Cat-26, Cat-3 & Cat-Other…..post.php

  • The topic ‘Help with a custom in_category statement’ is closed to new replies.