WordPress.org

Ready to get started?Download WordPress

Forums

current tag css class (20 posts)

  1. Indojepang
    Member
    Posted 5 years ago #

    what is css class for 'current tag'?

    Thanks

  2. Joni
    Member
    Posted 5 years ago #

    View your source code and you should see it.

  3. Indojepang
    Member
    Posted 5 years ago #

    thanks but it's not the answer.
    i'm trying to do highlighting the tag..

    I know how to highlight the page is current_page_item and the category is current-cat, but the tag.. i don't know the css class for it.

  4. Joni
    Member
    Posted 5 years ago #

    This is the best I could come up with, sorry.
    http://codex.wordpress.org/Template_Tags/single_tag_title

  5. Indojepang
    Member
    Posted 5 years ago #

    thanks joni for your help

  6. Indojepang
    Member
    Posted 5 years ago #

    anyone?
    or there is no css class for current tag?

  7. Ivovic
    Member
    Posted 5 years ago #

    how is it possible to have a current tag, unless you're viewing the tag archive?.. at which point it should be obvious by the honking big h1 or h2 tag at the top of the page.

  8. Indojepang
    Member
    Posted 5 years ago #

    yes it obvious enough.. i'm combining tags and categories as list of menus, it'l look strange if the categories highlighted when the tag is not, isn't it?
    just like my toothless smile :)

  9. bullrat
    Member
    Posted 5 years ago #

    indojepang, I'm in need of the very same thing as you. I have tags combined with categories in my menu system and since the tags don't receive the "current-cat" class, they don't highlight like the categories. Did you find an answer? I wish it were as simple as having a "wp_list_tags" like the "wp_list_categories"...

  10. kremalicious
    Member
    Posted 5 years ago #

    add me to the list of people searching for this. During my investigation I never found a 'current class' assigned to any tags when browsing the tag archive so I guess WordPress isn't capable of this feature. Or?

  11. tnerb
    Member
    Posted 5 years ago #

    I also have tags in navigation with categories and need to know 'current class' for tags - anyone find out how to do this yet?

  12. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    There is no "current class" for tags because that doesn't make any sense. There's no way to display tags as a list like there is with categories, so there's nothing to attach a class to.

    If you want a current class added, you have to tell us what the heck you want it added to. What sort of thing are you doing to display tags that you need a "current tag" class?

  13. mikedev
    Member
    Posted 5 years ago #

    I also am looking for the same thing. I have a "Blog" navigation item that highlights, (using "current_item" or "current_item_parent") when the post is in the "Blog" category.

    When a visitor clicks a tag in a post, it uses the tag archives template, and the "Blog" nav item is no longer highlighted. Category and single templates provide the "current_item" to the nav ul. The tag template needs to provide "current_item" to the nav ul.

    Using WP 2.5.1, Sandbox, NAVT.

  14. mikedev
    Member
    Posted 5 years ago #

    I think I just solved it using this in my CSS:

    body.tag a.navt_clink {
    background-image:url(/wp-includes/images/nav-graphic-blog-current.gif);
    background-repeat:no-repeat;
    }

    Now any post with the class "tag" in the body, I can style my category nav link.

  15. tnerb
    Member
    Posted 5 years ago #

    mikedev, I'm glad that worked for you. My problem (and I think also some of the others above) is that we're using tags in navigation lists like categories. Below is how I list some categories and the li automatically gets the "current-cat" class, when on that category page and it allows me to style differently - works great.

    I'd like to wrap a call listing tags in the same way but it doesn't pull the "current-cat" class (since it's a tag), so never styles as it should when on that tag page. We'd just like to know how to have a similar conditional class put on the current tag, so we could have it 'current' style like the categories do.

    Thanks for sharing, though. Much appreciated. Someone will figure this out sooner or later. I'd even consider editing the core classes file, if I knew how to modify.

    <li class="cat-group">SomeHeadingName</li>
     <ul class="cat-list">
     <?php [call specific tags here] ?>
     </ul>
    </li>
  16. iridiax
    Member
    Posted 5 years ago #

    Tags and categories are not interchangeable, tags just have less functionality for things like this than categories.

  17. tnerb
    Member
    Posted 5 years ago #

    iridax, thanks for your input and that's true what you say. But I still think there is a way to code a conditional class for the current tag - for when you're on the current tag's archive page. But I'm not the PHP whiz that can do it :-)

  18. tnerb
    Member
    Posted 5 years ago #

    I take that back - I guess I am a PHP whiz :-) Just kidding! Not. But I was able to figure out how to code this, so that now I can mix tags with my categories and still have the current class attach. Sweet.

  19. chopeh
    Member
    Posted 5 years ago #

    I take that back - I guess I am a PHP whiz :-) Just kidding! Not. But I was able to figure out how to code this, so that now I can mix tags with my categories and still have the current class attach. Sweet.

    Well do you mind telling anybody else how you did it? I've been stuggling with this for a while.

  20. sebisback
    Member
    Posted 5 years ago #

    Hi,

    Maybe you will find this plugin usefull :

    http://wordpress.org/extend/plugins/tag-functions/

    "Once this plugin is enabled, the template function btl_list_categories() will be available. The function will take the same parameters as wp_list_categories()" and will "list all available tags analagous to wp_list_categories()". It also adds the class="current-tag" to the current tag :)

    I used it for that exact purpose on this web site : http://www.irene.fr

    I hope this will help...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags