WordPress.org

Ready to get started?Download WordPress

Forums

highlight category when viewing signle post from that category (2 posts)

  1. Flegma
    Member
    Posted 3 years ago #

    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?

  2. Flegma
    Member
    Posted 3 years ago #

    Anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.