Forums

Conditional tags for current category?? (1 post)

  1. jockerworks
    Member
    Posted 4 years ago #

    Hi there, I am creating a new website and I started to wonder if there isn't any better method to create a navigation which highlights the current category/page/whatever it is.

    I mean, normally I tend to create a "manual" list of links to the categories, so that I can specify the whole series of

    is_category('1') class="Current"
    is_category('2') class="Current"

    and so on...
    the .Current class is applied because the is_category() conditional tag checks the category id, and if the id is the right one it prints 'class="Current"'

    isn't there a way to invert this process?

    Instead of having all the categories with this manual thing, isn't there a function/conditional tag/whatever which does something like

    let's take the wo_list_categories as an example:

    <?php wp_list_categories() ?>

    isn't there a way to specify what the

  2. element should do in case the category is being displayed?

    I'll go crazy now and give an example:
    <?php wp_list_categories(current_li="Current") ?>

    this is just an example.

    I don't necessarily want to achieve this result, I just want to know if there is a way to assign classes to a link of a currently displayed section/page/category of a wordpress powered website, automatically and without having to go with manual lists of links.

    In case there isn't anything similar I think such a thing would be an amazingly appreciated feature!!

    Thanks for reading, looking forward to read replies, and if that was needed, thanks so much for this piece of software!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags