walker menu active page

204 views Asked by At

I have a walker menu that works great...

// HEADER

<td class="main-nav">
<?php
$args = array(
    'theme_location' => 'primary',
    'walker' => new Walker_Menu
);
wp_nav_menu( $args );
?>
</td>

//FUNCTIONS

class Walker_Menu extends Walker {

var $db_fields = array(
    'parent' => 'menu_item_parent', 
    'id'     => 'db_id' 
);

function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
    $output .= sprintf( "\n<li><a href='%s'%s>%s</a></li>\n",
        $item->url,
        ( $item->object_id === get_the_ID() ) ? ' class="sliding-middle-out current"' : ' class="sliding-middle-out"',
        $item->title
    );
}

}

how would I get to highlight the active page ... something like

<?php

header(" echo home_url(); /". $_GET['pagetitle'] );

$mo = $_GET['pagetitle'];

?>

then add some css or ??

any help much appreciated

0

There are 0 answers