WordPress.org

Support

Support » Plugins and Hacks » Hacks » highlight category when viewing signle post from that category

highlight category when viewing signle post from that category

  • Hi,
    im using get_categories for listing categories as navigation in my custom theme.
    It works fine, but when i’m viewing a single post it does not highlight category. What i wanted to do is:
    1. when i click on category it is highlighted and all posts from within category is listed
    2. when i click on post category is hightlighted

    So far, i’ve done this :

    <?php $kategorije = get_categories('hide_empty=0');?>
    <?php foreach($kategorije as $kategorija): ?>
    <li <?php if ($kategorija->cat_name == single_cat_title('', FALSE)) echo 'class="odabran"'; ?>>/category/<?php echo $kategorija->category_nicename; ?> "title="<?php $kategorija->cat_name; ?>" >
    <span> <?php echo $kategorija->count;?> - </span><?php echo $kategorija->cat_name?>
    
    <?php endforeach ?>

    What am i missing here?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘highlight category when viewing signle post from that category’ is closed to new replies.
Skip to toolbar