Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a navigation menu in a page that highlights the current menu you’re on based on the URL by adding a class.

My problem is that my page is paginated, so sometimes the user will end up at: , /page/3/ , /page/4/ and so on...

what’s the best way to keep my menu highlighted while the user is browsing the pages?

This is my menu:

<div class="innerhead">


<code><li> <a href="">Calientes </a> </li>
<li><a href="">Tendencias</a></li>


This is the Script that use to highlight the current page menu:

    // this will get the full URL at the address bar
    var url = window.location.href; 

    // passes on every "a" tag 
    $(".innerhead a").each(function() {
            // checks if its the same on the address bar
        if(url == (this.href)) { 
share|improve this question
Close-voted as off-topic. As-written, this is a CSS/JS question, not a WordPress question. Per the WPSE FAQ, questions not specific to WordPress are out of scope, even if they happen in the context of WordPress*. –  Chip Bennett Oct 13 '13 at 23:00
I don't understand why you're adding the class after the menu is clicked... Anyway, if you want help here, you should show the PHP you're using to build the menu; and how this pagination is happening. –  brasofilo Oct 14 '13 at 0:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.