• Resolved abovegrnd

    (@abovegrnd)


    I’ve used this function in various other parts of my site, but for some reason in the most recent implementation it just isn’t working. I’m assuming that it’s returning false, although it should be returning positive. I’m trying to label different posts with an image based on the category. You should also know that all of the sub-categories are within a larger Category (“The Leak”).

    Here’s my code from the archive page:

    <?php while (have_posts()) : the_post(); ?>
    <div class="theleakpost">
    <div class="theleakheadline">
    <?php if(in_category('vids')) {
    echo "<img src='https://abovegroundmagazine.com/wp-content/themes/images/media-video.png' alt='' />";
    }
    elseif(in_category(562)) {
    echo "<img src='https://abovegroundmagazine.com/wp-content/themes/images/media-singles.png' alt='' />";
    }
    ?>
    <a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a></div>
    <div class="theleakinfo"><i>Posted by <?php the_author(); ?> on <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></i><?php edit_post_link('Edit', ' | '); ?> </div>
    <?php the_content('<p align=center>READ FULL POST</p>'); ?>
    <div class="theleakpostfooter">
    <?php the_tags(); ?> | Talk: <a href="<?php comments_link(); ?>"><?php comments_number('0 comments', '1 comment', '% comments'); ?></a>
    </div>
    </div>
    <?php endwhile; ?>

    I’ve tried every possible combination, including using the name, slug, and id of the category, with and without the minute marks.

    Any help???

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘in_category not working??’ is closed to new replies.