WordPress.org

Forums

Category single #current link (2 posts)

  1. tobbesanda
    Member
    Posted 6 years ago #

    Hi there!

    I've got a little problem over here. I want my category link be #current when I'm in a single post also. It works fine when I'm in the category page but when I jump into a single page in a category the current link in my menu don't appear. Here's my code:

    <li<?php
    if (is_category('training') || in_category('') && !is_single())
    {
    echo " id=\"current\"";
    }?>>
    <a href="<?php bloginfo('url') ?>/show/training">Training</a>

    Can you see anything wrong with this?

    /Tobias

  2. stvwlf
    Member
    Posted 6 years ago #

    This code && !is_single() says to not echo the ID when displaying a single page.

    That is not what you say you want.

Topic Closed

This topic has been closed to new replies.

About this Topic