Showing posts with label Call current class for wordpress menu tab. Show all posts
Showing posts with label Call current class for wordpress menu tab. Show all posts

Monday, February 11, 2013

Call current class for wordpress menu tab



Step 1: goto wp-includes/nav-menu-template.php
 
Paste this code near about line 87 and see magic

        $test=esc_attr( $item->url);
       
        $cuurrent_url ="http://".$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
       
       
       
        if($test==$cuurrent_url)
        {
        $attributes .= "class='current'";
       
        }
        if($test=="index.php" && empty($_GET['page_id']))
        {
            $attributes .= "class='current'";
       
        }

Popular Posts