Support » Fixing WordPress » Highlight current category in wordpress

  • I am interested in how to highlight the category in which I am present – with the “current” class in the template. The problem is compounded by the fact that the list of categories is not retrieved from the database WordPress (the same place, as I understand, they are stored?), that is – directly from the HTML… How to make the following code:

    code:

    <ul>
        <li class="blabla">
            <a>1</a>
        </li>
        <li class="blabla">
            <a>2</a>
        </li>
        <li class="blabla">
            <a>3</a>
        </li>
    </ul>

    code to be dynamic, for example when I go into the category of “2” to “li” will be added to the class “current”:

    code:

    <ul>
        <li class="blabla">
            <a>1</a>
        </li>
        <li class="blabla current">
            <a>2</a>
        </li>
        <li class="blabla">
            <a>3</a>
        </li>
    </ul>

    I tried to read the codex but I have two problems – I’m not good at php and most importantly hard to read in English

    I sincerely apologize for the broken English with which I asked, “that” the question

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Highlight current category in wordpress’ is closed to new replies.