Custom Walker – changing class for is_home()
-
Stuck a custom walker extension in to control list output so I could run a nav menu through a jquery lavaLamp effect. Got it working, but now trying to output class=”current” for the
<li>
of the current page only. Tried this:if (this.is_home()){ $class_names = ' class="current"';} else { $class_names = ' class="'. esc_attr( $class_names ) . '"'; } $output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
but its returning true for every item. I’m guessing I have a scope issue, but as I’m not good at programming I’m not sure what the problem is. Can anyone enlighten me? Here’s the full function:
[code moderated - remember to use the pastebin for any code over the forum limit of 10 lines]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom Walker – changing class for is_home()’ is closed to new replies.